Answer the question
In order to leave comments, you need to log in
How to add and remove categories in franzose/ClosureTable for Laravel?
Good day!
How to add and remove categories (records) in franzose/ClosureTable for Laravel?
addChild() is when an entry is selected. And if the database does not yet have more than one record, then how to add a new one? new Model(array(...))->save();
- writes to the database, but phpMyAdmin starts to swear when fetching, gives a bunch of errors and the question is whether to ignore them or not.
SQL query
Answer the question
In order to leave comments, you need to log in
And if the database does not yet have more than one record, then how to add a new one?
$category = new Category([
'title' => 'News'
]);
$category->makeRoot(0);
$category = new Category;
$category->title = 'News';
$category->save();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question