Closed maxhacker11 closed 3 years ago
I figured it out, holy smokes I am pissed off at myself xD This was my order:
$business->attachCategories(1);
$business->save();
It didn't work, so after using php artisan tinker and seeing that it works there, i just reversed it:
$business->save();
$business->attachCategories(1);
Glad you got it sorted ;)
Doesn't work when I try to attach:
$business->attachCategories(1);
The category exists in the categories table, it's ID is 1. I literally have no clue what's happening.
I get the following error:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'categorizable_id' cannot be null