示例#1
0
    return App\Category::whereSlug($slug)->first();
});
Route::bind('device', function ($slug) {
    return App\Device::whereSlug($slug)->first();
});
Route::bind('status', function ($slug) {
    return App\Status::whereSlug($slug)->first();
});
Route::bind('owner', function ($slug) {
    return App\Owner::whereSlug($slug)->first();
});
Route::bind('user', function ($id) {
    return App\User::find($id);
});
Route::bind('note', function ($id) {
    return App\Note::find($id);
});
Route::bind('information', function ($id) {
    return App\Information::find($id);
});
Route::bind('field', function ($id) {
    return App\Field::find($id);
});
Route::bind('activity', function ($id) {
    return App\Activity::find($id);
});
# ROUTE RESOURCE
# CATEGORY RESOURCE
Route::resource('category', 'CategoryController');
Route::get('change_password', ['as' => 'change_password', 'uses' => 'UserController@viewChangePassword']);
// GET
示例#2
0
<?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 () {
//    return view('index');
//});
Route::get('/', 'NotesController@index');
Route::get('/register', 'NotesController@showRegister');
Route::get('/forgotpassword', 'NotesController@forgotPassword');
Route::post('/', 'NotesController@login');
Route::post('/register', 'NotesController@register');
Route::get('/notes', 'NotesController@showNotes');
Route::get('/logout', 'NotesController@logout');
Route::post('/notes', 'NotesController@saveNotes');
Route::get('/user/{id}/image', function ($id) {
    $note = App\Note::find($id);
    $response = Response::make($note->image, 200);
    $response->header('Content-Type', 'image/jpeg');
    return $response;
});