Exemple #1
0
| 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::group(['middleware' => 'auth'], function () {
    Route::resource('applicants', 'ApplicantsController');
    Route::get('applicants/{applicants}/restore', 'ApplicantsController@restore');
});
Route::get('users/add', function () {
    $user = new App\User(['name' => 'Johari', 'email' => '*****@*****.**', 'password' => bcrypt('123456')]);
    $user->save();
    var_dump($user);
    DB::transaction(function () use($user) {
        $user->id = 1;
        $user->save();
    });
    // Laravel 5.1.27
    $user->id = 1;
    $user->saveOrFail();
});
Route::get('users', function () {
    $users = Cache::remember('users', 60, function () {
        return App\User::has('applicants')->get();
    });
    return view('welcome');
});
Route::get('/', function () {
    return view('welcome');
});
Route::get('home', 'HomeController@index');
Route::controllers(['auth' => 'Auth\\AuthController', 'password' => 'Auth\\PasswordController']);