使用app.blade laravel 4中的控制器发送数据

时间:2015-09-30 06:42:51

标签: laravel laravel-4 laravel-routing

我有一个UserController,我希望将UserController功能的数据发送到app.blade.php

function sessionUser(){
        $data['status'] = Auth::user()->status;
        $data['id'] = Auth::id();
        $data['values]=DB::table('user_permission)->get();
        return view('app.blade', compact('data'));
    }

和app.blade.php

dd($data);

1 个答案:

答案 0 :(得分:0)

试一试:

function sessionUser(){
    $data['status'] = Auth::user()->status;
    $data['id'] = Auth::id();
    $data['values']=DB::table('user_permission')->get();
    return view('app')->with($data);
}

或者

function sessionUser(){
    $status = Auth::user()->status;
    $id = Auth::id();
    $values = DB::table('user_permission')->get();
    return view('app', compact('status','id','values'));
}

然后echo dd($status);