Courses

Laravel 9 For Beginners: Your First Project

Manage Categories CRUD: Table, Edit, Create, Delete

avatar

I tried to check the data passed to the view in devtools but the response is a web page; Is there a way to check this returned data with devtools ? Thanks,

avatar

In this case, returned data is actually a web page, not sure what data exactly you want to check? Give more details please.

avatar

I mean by data the array of categories that we passed to the view. Thanks;

avatar

I usually do the dd($categories); before returning to the view. And there are other tools for debugging, like Spatie Ray, but it's not free.

avatar

Ok, thank you.

avatar

Careful if you use the tables from part 2, when you try to delete a category thay will be a constrained error.

You can add :

$table->foreignId('category_id')->constrained()->onDelete('cascade')->onUpdate('cascade');

to your posts migration.

👍 1
avatar

Well noted, thanks!