I have a Mysql Table my table screenshort This is my Model namespace App; use Illuminate\Database\Eloquent\Model; class Categories extends Model { protected $table = 'category'; protected $fillable = ['category_name', 'parent_id', 'category_level', 'last_level', 'description', 'category_image']; protected $guarded = ['id']; public function parent() { return $this->belongsTo('App\Categories', 'parent_id'); } public function children() { return $this->hasMany('App\Categories','parent_id'); } }
and This Controller Method
public function create() {
$parentCategory = Categories::all();
return view('admin.add_category')->with('parentCategory', $parentCategory);
}
I want to this Result enter image description here
and how it posible? please help me! how can i do it.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire