view()->composer('*', function($view) use ($auth) {
$currentUser = $auth->user();
// делайте что душе угодно, и передавайте переменной во все view
$view->with('currentUser', $currentUser);
});
"files": [
"app/helpers.php"
]
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
},
"files": [
"app/helpers.php"
]
},
Route::get('/portfolio/{category?}', 'PortfolioController@index');
public function index($catergory = null){
if(is_null($catergory )) {
$portfolio = Portfolio:paginate(10);
} else {
$portfolio = Portfolio::where("catergory", $catergory )->paginate(10);
}
return view("portfolio", compact('portfolio'));
}