Exemplo n.º 1
0
 /**
  * Compose left navigation for admin left menu
  */
 private function composeLeftNavigation()
 {
     view()->composer('admin.shared.left', function ($view) {
         $total = new \stdClass();
         $total->menu = Menu::count();
         $total->category = Cat::count();
         $total->content = Content::count();
         $view->with('total', $total);
     });
 }
Exemplo n.º 2
0
 public function pages()
 {
     $slug = Route::getCurrentRoute()->getPath();
     $content = Menu::where('slug', $slug)->first();
     if ($content->content_id > 0) {
         $content['data'] = $content->content;
         $content['data']['html'] = json_decode($content->content->content);
     } elseif ($content->cat_id > 0) {
         $cat_id = $content->category->id;
         $contents = Content::where('cat_id', $cat_id)->get();
         $array = [];
         $counter = 0;
         foreach ($contents as $c) {
             $array[$counter] = $c;
             $array[$counter]['html'] = json_decode($c->content);
             $counter++;
         }
         $content['data'] = collect($array)->toArray();
     }
     return $content;
 }
Exemplo n.º 3
0
<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
$menus = \App\Models\Admin\Menu::all();
if (count($menus) > 0) {
    foreach ($menus as $menu) {
        if ($menu->raw_path != NULL) {
            Route::get($menu->slug, $menu->raw_path);
        } else {
            Route::get($menu->slug, 'PageController@pages');
        }
    }
}
// admin routes
Route::group(['as' => 'admin.', 'middleware' => 'auth', 'namespace' => 'Admin', 'prefix' => 'dashboard'], function () {
    Route::get('/', ['as' => 'root', 'uses' => 'AdminController@index']);
    // menu
    Route::get('/menus', ['as' => 'menu', 'uses' => 'AdminMenuController@index']);
    Route::get('/menus/create', ['as' => 'menu.create', 'uses' => 'AdminMenuController@create']);
    Route::post('/menus/create', ['as' => 'menu.store', 'uses' => 'AdminMenuController@store']);
    Route::get('/menus/{menu}/edit', ['as' => 'menu.edit', 'uses' => 'AdminMenuController@edit']);
    Route::put('/menus/{menu}/edit', ['as' => 'menu.update', 'uses' => 'AdminMenuController@update']);
Exemplo n.º 4
0
 /**
  * Unpublish items
  *
  * @param  UpdateStateRequest $request
  * @return \Illuminate\Http\Response
  */
 public function unpublish(UpdateStateRequest $request)
 {
     $items = $request->input('items');
     $request->session()->flash('alert-success', 'Selected menus has been unpublished!');
     return Menu::whereIn('id', $items)->update(['state' => 0]);
 }