模板地址生成:
<a href="{{action('index@index',['id'=>3])}}">查看</a>
laravel表单:{{csrf_field()}}
中间件路由:
Route::group(['middleware'=>'userCheck'],function(){
Route::get('/home','index@home');
Route::group(['middleware' => 'adminCheck'], function () {
Route::get('newsview/{id}','index@newsview');
});
});
指定视图数据预加载
ServiceProvider中的boot:
public function boot()
{
//
// view()->share('nav',$rs);
view::composer('common.nav',function($e){
$rs=DB::table('newstype')->take(11)->get();
$e->with('nav',$rs);
});
}