mardi 17 octobre 2017

Menu controller is not found laravel 5.5.check my code please and help me where am wrong

check my code please and help me where am wrong. am try to get date from Menu and SubMenu table using Eloquent model instead of join etc. my Menucontroller

class MenuController extends Controller
{
// Where ever you want your menu
    public function menu()
    {

        $menu = Menu::all()->load('submenu');

        return view('menu',['users' => $menu]);
    }
}

my menu Model is

use Illuminate\Database\Eloquent\Model;
class Menu extends Model
{


    public function submenu()
    {
        return $this->hasMany(SubMenu::class);
    }
}

my submenu model is

use Illuminate\Database\Eloquent\Model;
class SubMenu extends Model
{
    public function menu()
    {
        return $this->belongsTo(Menu::class);
    }
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire