示例#1
0
 * Frontend Controllers.
 */
get('/old', 'FrontendController@home')->name('old');
get('macros', 'FrontendController@macros');
get('/', 'FrontendController@home')->name('home');
get('/root', 'FrontendController@home');
use App\Models\Project;
use App\Models\Task;
Route::model('projects', 'App\\Models\\Project');
Route::model('tasks', 'App\\Models\\Task');
Route::bind('tasks', function ($value, $route) {
    return App\Models\Task::whereSlug($value)->first();
});
Route::bind('projects', function ($value, $route) {
    if (is_int($value)) {
        return App\Models\Project::whereId($value)->first();
    } else {
        return App\Models\Project::whereSlug($value)->first();
    }
});
Route::resource('projects', 'ProjectsController');
Route::resource('projects.tasks', 'TasksController');
/*
 * These frontend controllers require the user to be logged in
 */
$router->group(['middleware' => 'auth'], function () {
    get('dashboard', 'DashboardController@index')->name('frontend.dashboard');
    get('profile/edit', 'ProfileController@edit')->name('frontend.profile.edit');
    patch('profile/update', 'ProfileController@update')->name('frontend.profile.update');
    get('projects/create', 'ProjectsController@create')->name('projects.create');
});
|
| 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('/', 'WelcomeController@index');
Route::get('/', 'PhasesController@index');
Route::get('home', 'PhasesController@index');
Route::controllers(['auth' => 'Auth\\AuthController', 'password' => 'Auth\\PasswordController']);
$router->bind('projects', function ($slug) {
    /**
     *
     * retrieve the first slug matching the query in the db
     */
    return \App\models\Project::whereSlug($slug)->first();
});
$router->bind('clients', function ($id) {
    return \App\models\Client::whereId($id)->first();
});
$router->bind('types', function ($id) {
    return \App\models\Type::whereId($id)->first();
});
$router->bind('phases', function ($id) {
    return \App\models\Phase::whereId($id)->first();
});
Route::get('search/{word}', 'PagesController@search');
Route::resource('clients', 'ClientsController');
Route::resource('types', 'TypesController');
Route::resource('phases', 'PhasesController');
Route::get('phases/addTiming/{id}', 'PhasesController@timing');