public function getMenu()
{
return $menuBuilder = (new Menu)->make('adminMenu', function($menu){
$menu->add('Статьи',['route' => 'admin.articles.index']);
$menu->add('Портфолио',['route' => 'admin.articles.index']);
$menu->add('Меню',['route' => 'admin.articles.index']);
$menu->add('Пользователи',['route' => 'admin.articles.index']);
$menu->add('Привелегии',['route' => 'admin.articles.index']);
});
}
protected function redirectTo($request)
{
if (! $request->expectsJson()) {
return route('login');
}
}
Auth::routes();
Route::get('login', 'Auth\LoginController@showLoginForm');
Route::post('login', 'Auth\LoginController@login');
use AuthenticatesUsers;
/**
* Where to redirect users after login.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::ADMIN;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest')->except('logout');
}
public function showLoginForm()
{
return view(env('THEME').'.login')->with('title','Вход на сайт');
}
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Auth;
use Lavary\Menu\Menu;
class AdminController extends Controller
{
//
protected $p_rep;
protected $a_rep;
protected $articles;
protected $user;
protected $template;
protected $content = FALSE;
protected $title;
protected $vars;
public function __construct()
{
$this->middleware('auth');
$this->user = Auth::user();
if(!$this->user){
abort(403);
}
}
public function renderOutput()
{
$this->vars = Arr::add($this->vars,'title',$this->title);
$menu = $this->getMenu();
$navigation = view(env('THEME').'.admin.navigation')->with('menu',$menu)->render();
$this->vars = Arr::add($this->vars,'navigation',$navigation);
if($this->content) {
$this->vars = Arr::add($this->vars,'content',$this->content);
}
$footer = view(env('THEME').'.admin.footer')->render();
$this->vars = Arr::add($this->vars,'footer',$footer);
return view($this->template)->with($this->vars);
}
public function getMenu()
{
return $menuBuilder = (new Menu)->make('adminMenu', function($menu){
$menu->add('Статьи',['route' => 'admin.articles.index']);
$menu->add('Портфолио',['route' => 'admin.articles.index']);
$menu->add('Меню',['route' => 'admin.articles.index']);
$menu->add('Пользователи',['route' => 'admin.articles.index']);
$menu->add('Привелегии',['route' => 'admin.articles.index']);
});
}
}