Skip to main content
Richard A. Hoyle avatar

Tried to get my version of your program to work but temporality gave up and decided to try and work with yours to figure out what I am doing wrong. Having after I downloaded your GitHub repository and set it up which went ok. I try to delete a company and get the following Error.

 
SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`lvdy_reservations`.`activities`, CONSTRAINT `activities_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`))
 
delete from `companies` where `id` = 4
 
public function destroy(Company $company)
 
{
 
$company->delete();
 
 
 
return to_route('companies.index');
 
}

How can I fix this or better yeat sence it is your code can you?

Ok yes if you delete the activities first then you can delete the company so I thank we need to disable the company delete if there are any activities available what do you thank.

Nerijus avatar

cascadeOnDelete() should work

Davery avatar

I'm getting an error on the test test_pdf_export, any ideas? I think it has something to do with the formatting, but not sure.

Failed asserting that two strings are equal.
-'attachment; filename="quasi.pdf"'
+'attachment; filename=quasi.pdf'
Nerijus avatar

Message is very clear. You expect some value but get a different one

Davery avatar

For anyone else who runs into the failing test. Update this line from the above test:

$this->assertEquals('attachment; filename="' . $activity->name .'.pdf"', $response->headers->get('Content-Disposition'));

to this:

$this->assertEquals('attachment; filename='.$activity->name.'.pdf', $response->headers->get('Content-Disposition'));