skip to Main Content

I cannot delete data which have many-to-many relationship in laravel 9 – PHP

I am using PHP 8.2.0, MySQL 8.2.0, and Laravel 9.48.0. This is my database migrations file pivot table (category_menu): public function up() { Schema::create('category_menu', function (Blueprint $table) { $table->foreignId('category_id')->constrained(); $table->foreignId('menu_id')->constrained(); }); } This is the CategoryController.php: public function destroy(Category $category)…

VIEW QUESTION

How to add information to a pivot table in laravel?

I have a many:many relation between student and course. Here are my models and my pivot table: <?php namespace AppModels; use IlluminateDatabaseEloquentFactoriesHasFactory; use IlluminateDatabaseEloquentModel; class Student extends Model { use HasFactory; protected $fillable = [ 'name', 'surname', 'age', 'tdah', 'description',…

VIEW QUESTION
Back To Top
Search