Current File : /home/tradevaly/text.tradevaly.com.bd/app/Models/Item.php
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
class Item extends Model
{
    use HasFactory;
   public function parent(){
        return $this->belongsTo(Item::class, 'parent_id', 'id');
    }
    
     public function categories(){
        return $this->hasMany(Item::class, 'id','parent_id');
    }
}