Current File : //proc/thread-self/root/proc/self/root/home/tradevaly/new.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');
    }
}