Example #1
0
Route::get('auth/register', 'Auth\\AuthController@getRegister');
Route::post('auth/register', 'Auth\\AuthController@postRegister');
// FRIENDSHIP ROUTES
Route::get('user/{user}/addFriend', ['as' => 'addFriend', 'uses' => 'UserController@addFriend']);
Route::get('friend/{user}/approveFriend', ['as' => 'approveFriend', 'uses' => 'FriendController@approveFriend']);
Route::get('friend/{user}/denyFriend', ['as' => 'denyFriend', 'uses' => 'FriendController@denyFriend']);
// RESOURCE ROUTES...
Route::resource('user', 'UserController', ['except' => ['create', 'store']]);
Route::resource('blog', 'BlogController', ['except' => ['create', 'delete', 'store']]);
Route::resource('blog.blogPost', 'BlogPostController');
Route::get('/blogPost', ['uses' => 'BlogPostController@index', 'as' => 'blogPosts.index']);
Route::resource('blog.blogPost.photo', 'PhotoController', ['except' => ['index', 'show', 'create']]);
Route::get('/', ['uses' => 'PagesController@index']);
// ROUTE MODEL BINDINGS...
Route::bind('user', function ($value) {
    return App\User::with('blog')->findOrFail($value);
});
Route::bind('blog', function ($value) {
    // de-hyphenate the blog name
    $value = getNameForThisUrl($value);
    // return the Blog instance with the name of $value, with blogPosts
    return App\Blog::with('blogPost')->where('name', $value)->firstOrFail();
});
Route::bind('blogPost', function ($value) {
    // de-hyphenate the blog name
    $value = getNameForThisUrl($value);
    // return the Blog instance with the name of $value, with blogPosts
    return App\BlogPost::with('photo')->where('title', $value)->firstOrFail();
});
Route::bind('photo', function ($value) {
    return App\Photo::findOrFail($value);
Example #2
0
         * =================================================================================
         * Roles
         */
        Route::get('roles/detatch_user/{user}/role/{role}', ['as' => 'admin.roles.detatch_user', 'uses' => 'RolesController@detatchUser']);
        Route::get('roles/search', ['as' => 'admin.roles.search', 'uses' => 'RolesController@search']);
        Route::bind('roles', function ($id) {
            return App\Role::with('users')->findOrFail($id);
        });
        Route::resource('roles', 'RolesController');
        /**
         * =============================================================
         * Todos
         */
        Route::get('todos/completar/{id}', ['as' => 'admin.todos.completar', 'uses' => 'TodosController@completar']);
        Route::get('todos/incompletar/{id}', ['as' => 'admin.todos.incompletar', 'uses' => 'TodosController@incompletar']);
        Route::delete('todos/remove_done_tasks', ['as' => 'admin.todos.remove_done_tasks', 'uses' => 'TodosController@removeDoneTasks']);
        Route::bind("todos", function ($id) {
            return \App\Todo::whereUserId(Auth::user()->id)->findOrFail($id);
        });
        Route::resource('todos', 'TodosController', []);
        /**
         * ==============================================================
         * Users Management
         */
        Route::get('users/search', ['as' => 'admin.users.search', 'uses' => 'UsersController@search']);
        Route::bind('users', function ($id) {
            return App\User::with('role')->findOrFail($id);
        });
        Route::resource('users', 'UsersController');
    });
});
Example #3
0
| 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.
|
*/
Route::get('/', function () {
    return view('welcome');
});
Route::get('dashboard', ['middleware' => 'auth', function () {
    return view('dashboard');
}]);
Route::get('/employees', function () {
    return view('employees', ['Users' => App\User::with('Messages')->get()]);
});
Route::get('/skills', function () {
    return view('skills', ['Skills' => App\Skill::with('Messages')->get()]);
});
Route::get('/recruiters', function () {
    return view('recruiters', ['Recruiters' => App\Recruiter::with('Messages')->get()]);
});
Route::get('/messages', function () {
    return view('messages', ['Messages' => App\Message::with('Recruiter', 'Employee')->get()]);
});
Route::get('messages/{id}', function ($message_id) {
    return App\Message::find($message_id)->body;
});
// Authentication routes...
Route::get('auth/login', 'Auth\\AuthController@getLogin');
Example #4
0
<?php

resource('posts', 'PostController');
// API ROUTES FOR VUE
Route::group(['prefix' => 'api'], function () {
    get('users-get', function () {
        return App\User::with(['roles', 'profile', 'status'])->get();
    });
    get('roles-get', function () {
        return App\Role::all();
    });
    get('statuses-get', function () {
        return App\Status::all();
    });
});
Route::group(['namespace' => 'Admin', 'as' => 'Admin::', 'prefix' => 'admin', 'middleware' => 'auth'], function () {
    get('/', function () {
        if (!Auth::user()->hasRole('user')) {
            return redirect()->route('Admin::dashboard');
        }
        return redirect()->route('Site::index');
    });
    get('/dashboard', ['as' => 'dashboard', 'uses' => 'AdminController@index']);
});
Route::group(['namespace' => 'Site', 'as' => 'Site::'], function () {
    get('/', function () {
        return redirect()->route('Site::index');
    });
    get('/home', ['as' => 'index', 'uses' => 'SiteController@index']);
    get('/github', ['as' => 'github', 'uses' => 'SiteController@github']);
    get('/contribute', ['as' => 'contribute', 'uses' => 'SiteController@contribute']);
Example #5
0
    Route::get('dailysales/all', ['uses' => 'DashboardController@getDailySalesAll']);
    Route::get('api/tsv', ['uses' => 'DashboardController@getDashboardTSV']);
    Route::get('api/csv', ['uses' => 'DashboardController@getDashboardCSV']);
    Route::post('api/csv/comparative', ['uses' => 'BranchController@getComparativeCSV']);
    Route::post('api/json/comparative', ['uses' => 'BranchController@getComparativeJSON']);
    /******************* API  *************************************************/
    Route::group(['prefix' => 'api'], function () {
        Route::get('t/purchase', ['uses' => 'PurchaseController@apiGetPurchase']);
    });
    /******* end prefix:api ********/
});
/******* end middeware:auth ********/
get('branch', function () {
    return App\User::with(['bossbranch' => function ($query) {
        $query->select('bossid', 'branchid', 'id')->with(['branch' => function ($query) {
            $query->select('code', 'descriptor', 'id');
        }]);
    }])->get();
});
get('getweek', function () {
    return range(14, 17);
    $arr = [];
    for ($i = 2008; $i < 2021; $i++) {
        $date = Carbon\Carbon::parse($i . '-08-27');
        array_push($arr, ['year' => $i, 'day' => $date->endOfYear()->format('Y-m-d D'), 'week' => $date->endOfYear()->weekOfYear, 'wday' => $date->endOfYear()->dayOfWeek, 'lwoy' => lastWeekOfYear($i)]);
    }
    return $arr;
});
get('dailysales/recompute', function () {
    $dss = App\Models\DailySales::all();
    //$dss = App\Models\DailySales::take(10)->get();
Example #6
0
| Routes File
|--------------------------------------------------------------------------
|
| Here is where you will register all of the routes in 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.
|
*/
Route::get('/', function () {
    return view('welcome');
});
Route::group(['prefix' => 'api'], function () {
    // Simple heartbeat
    Route::get('heartbeat', "DefaultController@getHeartbeat");
    Route::get('data', function () {
        return App\User::with('events')->with('registered')->get();
    });
    // Login / register, unprotected
    Route::group(['prefix' => 'user'], function () {
        Route::post('create', "UserController@createUser");
        Route::post('login', "UserController@loginUser");
    });
    // Everything else, protected
    Route::group(['middleware' => ['hackbu']], function () {
        Route::group(['prefix' => 'user'], function () {
            Route::post('events', "UserController@userEvents");
        });
        Route::group(['prefix' => 'events'], function () {
            Route::get('list', "EventsController@listEvents");
            Route::post('create', "EventsController@createEvent");
            Route::post('register/{event_id}', "EventsController@registerForEvent");
<?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.
|
*/
Route::get('/', function () {
    $query = App\User::with('clans', 'friendsIn', 'friendsOut');
    if ($orderBy = Request::get('order_by')) {
        switch ($orderBy) {
            case 'friends':
                $query = $query->orderByFriends();
                break;
            case 'clans':
                $query = $query->orderByClans();
                break;
            default:
                $query = $query->orderBy($orderBy, 'desc');
                break;
        }
    }
    $users = $query->paginate(25);
    $clansInfo = $users->reduce(function ($carry, $user) {
        $userClans = $user->clans;
        return $userClans->reduce(function ($c2, $clan) {