samedi 30 mai 2020

laravel 7 edit old value not selected form

hello i use this code for select category in edit form and it is not work! this line not work

<option value=""  >

and use this but two code not worked!

 

my code is

 <option value="0">دسته اصلی</option>
@foreach(\App\Category::all() as $category)
<option value=""  >
 @if($category->parent== 0)
 
 @else
-- 
 @endif
</option>
@endforeach

and my model category this

  public function child()
{
    return $this->hasMany(Category::class, 'parent', 'id');
}

public function get_parent()
{
    return $this->hasOne(Category::class,'id','parent');
}


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire