本文整理汇总了PHP中MenuItem::all方法的典型用法代码示例。如果您正苦于以下问题:PHP MenuItem::all方法的具体用法?PHP MenuItem::all怎么用?PHP MenuItem::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MenuItem
的用法示例。
在下文中一共展示了MenuItem::all方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dashBoard
public function dashBoard()
{
$menu_items = \MenuItem::all();
$categories = \MenuCategory::all();
if (\Auth::check()) {
return \View::make('admin.dashboard')->with('menu_items', $menu_items)->with('categories', $categories);
}
return \View::make('accounts.login');
}
示例2: checkLogin
public function checkLogin()
{
$username = \Input::get('username');
$password = \Input::get('password');
$validator = new Validate();
$validated = $validator->validateCreds();
$attempt = \Auth::attempt(array('username' => $username, 'password' => $password));
$menu_items = \MenuItem::all();
$categories = \MenuCategory::all();
if ($validated->passes()) {
if (!\Auth::validate(array('username' => $username, 'password' => $password))) {
return \View::make('accounts.login')->withErrors($validated)->withInput(\Input::only('username'))->with('message', '<p class="alert alert-dismissible alert-danger">Invalid username or password</p>');
}
if ($attempt === true) {
return \View::make('admin.dashboard')->with('menu_items', $menu_items)->with('categories', $categories);
}
}
return \View::make('accounts.login')->withErrors($validated)->withInput(\Input::only('username'));
}
示例3: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$menuItems = MenuItem::all();
$this->layout->title = 'Menu';
$this->layout->main = View::make('dash')->nest('content', 'menu.index', compact('menuItems'));
}
示例4: function
Route::filter('auth', function()
{
if (Auth::guest()) return Redirect::guest('auth/login');
});
*/
Route::controller('password', 'RemindersController');
/* tests ci-dessous */
Route::controller('users', 'UsersController');
Route::get('login', ['as' => 'login', 'uses' => 'AuthController@getLogin']);
Route::get('logout', ['as' => 'logout', 'uses' => 'AuthController@getLogout']);
Route::post('/post/{post}/comment', ['as' => 'comment.new', 'uses' => 'CommentController@newComment']);
View::composer('sidebar', function ($view) {
$view->recentPosts = Post::orderBy('id', 'desc')->take(5)->get();
});
View::composer('menu', function ($view) {
$view->menuItems = MenuItem::all();
});
/* Model Bindings */
Route::model('post', 'Post');
Route::model('comment', 'Comment');
Route::model('pages', 'Page');
Route::model('menuItem', 'MenuItem');
Route::model('user', 'User');
Route::model('page', 'Page');
// ===============================================
// ADMIN SECTION =================================
// ===============================================
/* Admin routes */
Route::group(['prefix' => 'admin', 'before' => 'auth'], function () {
/*get routes*/
Route::get('/', array('as' => 'admin', function () {