سلام دوستان
من میخوام دسته بندی ایجاد کنم شبیه تصویر زیر
حالا نمیدونم کدومش دسته است کدومش زیر دسته کجا parent_id
بدم کجاهاش id
بدم.
اینم جدول هاش
public function up() { Schema::create('invoices', function (Blueprint $table) { $table->bigIncrements('id'); $table->string('description'); $table->string('price'); $table->timestamps(); }); }
و
{ Schema::create('services', function (Blueprint $table) { $table->bigIncrements('id'); $table->bigInteger('user_id')->unsigned(); $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); $table->string('title'); $table->string('slug'); $table->string('lang'); $table->string('image')->nullable(); $table->text('body'); $table->timestamps(); }); Schema::create('invoice_service', function (Blueprint $table) { $table->bigInteger('invoice_id')->unsigned(); $table->foreign('invoice_id')->references('id')->on('invoices')->onDelete('cascade'); $table->bigInteger('service_id')->unsigned(); $table->foreign('service_id')->references('id')->on('services')->onDelete('cascade'); $table->primary(['invoice_id', 'service_id']); }); }
و جدول categories
public function up() { Schema::create('categories', function (Blueprint $table) { $table->bigIncrements('id'); $table->string('name'); $table->string('lang'); $table->string('slug')->nullable(); $table->integer('parent_id'); $table->string('icon')->nullable(); $table->timestamps(); }); }
و من فرم رو شبیه تصویر زیر را دارم.
لطفا خواهشا اگر چیزی کم داره در فرم و در جدول، بگین لطفا که چی کم داره یا جاگزاشتم
یه سر به گفتگوی زیر بزنید.
دستهبندی مدلهای الکوئنت در لاراول
میتونید از این پکیج برای مدیریت دسته بندی های ساده و تو در تو استفاده کنید. و برای هر Model هم که احتیاج به دسته بندی باشه فقط لازمه از Trait پکیج در داخل Model استفاده کنی.
آیا مایل به ارسال نوتیفیکیشن و اخبار از طرف راکت هستید ؟