Example #1
0
 public function init()
 {
     // Оформление
     $this->setClass('primary');
     // Общие данные
     $this->addColumn("login", "text", array("label" => "Логин"));
     $this->addColumn("name", "text", array("label" => "Имя"));
     $this->addColumn("email", "text", array("label" => "Email"));
     $this->addColumn('is_active', "ajaxToggler", array("label" => "Активный", "action" => array("route" => Backend::getPathPrefix() . ".users.ajaxUpdate", "params" => array("id" => "{backend_user_id}"))));
     // Действия над пользователем
     $this->addColumn("edit", "icon", array("icon" => "edit", "link" => array("route" => Backend::getPathPrefix() . ".users.edit", "params" => array("id" => "{backend_user_id}"))));
     $this->addColumn("delete", "icon", array("icon" => "times", "method" => "delete", "class" => "js-confirm", "link" => array("route" => Backend::getPathPrefix() . ".users.destroy", "params" => array("id" => "{backend_user_id}"))));
     // Действия над пользователями
     $this->addAction("add", array("icon" => "plus", "link" => array("route" => \Backend::getPathPrefix() . '.users.create'), 'label' => 'Добавить пользователя'));
 }
Example #2
0
<?php

// Сбоку
Navigation::getSection('Sidebar')->addItem('MAIN', '/' . \Backend::getPathPrefix(), array('label' => 'Главная', 'icon' => 'dashboard', 'order' => 1));
Navigation::getSection('Sidebar')->addItem('BACKEND_USERS', array(\Backend::getPathPrefix() . '.backend_users.index', array()), array('label' => 'Администраторы', 'icon' => 'user', 'order' => 2));
// Меню наверху
Navigation::getSection('Topbar')->addItem('MAINPAGE', '/', array('label' => 'Перейти на сайт', 'order' => 1));
Navigation::getSection('Topbar')->addItem('SETTINGS', \Backend::getPathPrefix(), array('label' => 'Общие настройки', 'order' => 2));
Example #3
0
/**
 * Админка
 */
Route::group(['prefix' => \Backend::getPathPrefix(), 'namespace' => 'Doberbeatz\\Laraback', 'before' => array('backend.auth')], function () {
    Route::get('/', ['as' => \Backend::getPathPrefix() . '.main', 'uses' => 'BackendController@index']);
    /** Администраторы **/
    Route::get('backend_users/ajaxUpdate', array('as' => \Backend::getPathPrefix() . '.backend_users.ajaxUpdate', 'uses' => 'BackendUsersController@ajaxUpdate'));
    Route::resource('backend_users', "BackendUsersController");
});
/**
 * Авторизация
 */
Route::group(['prefix' => \Backend::getPathPrefix(), 'namespace' => 'Doberbeatz\\Laraback\\Controllers'], function () {
    /** Форма логина **/
    Route::get('login', "AuthController@index");
    /** Авторизация **/
    Route::post('login', array('before' => 'backend.auth.config', "as" => \Backend::getPathPrefix() . "/login", function () {
        $userdata = array('login' => Input::get('login'), 'password' => Input::get('password'), 'is_active' => 1);
        if (BackendAuth::attempt($userdata)) {
            return Redirect::to(\Backend::getPathPrefix());
        } else {
            return Redirect::to(\Backend::getPathPrefix() . '/login')->with('login_errors', true);
        }
    }));
    /** Выход **/
    Route::get('logout', array("as" => \Backend::getPathPrefix() . "/logout", function () {
        BackendAuth::logout();
        return Redirect::to(\Backend::getPathPrefix() . '/login');
    }));
});