예제 #1
0
 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
0
 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'));
 }
 /**
  * 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
0
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 () {