No idea what your question is @deepakagarwal - maybe consider giving us the error message??? Also explain what you are trying to achieve.
Feb 1, 2022
3
Level 1
relationship issues in laravel 8
I have three tables namely category, subcategory, and services.
Basically, I wanna relations on this bellowed table respectively,
1) category -> has many sub-category
2) each subcategory -> has many services
Category and sub-category table
public function up()
{
Schema::create('categories', function (Blueprint $table) {
$table->id();
$table->text('category_name')->nullable();
$table->integer('parents_id');
$table->timestamps();
});
}
services table
public function up()
{
Schema::create('services', function (Blueprint $table) {
$table->id();
$table->text('ser_name')->nullable();
$table->text('title')->nullable();
$table->text('image')->nullable();
$table->text('description')->nullable();
$table->integer('cat')->nullable();
$table->integer('sub_cat')->nullable();
$table->integer('price')->nullable();
$table->boolean('status')->nullable();
$table->timestamps();
});
}
Note: on update and delete, only particular services would be get updated and deleted and on either parent category or subcategory deletion, it gives error for services available under a particular subcategory to delete first
I want this type of 'mega menu' structure for these relations:

Please or to participate in this conversation.