コード例 #1
0
 public function delete($id)
 {
     $book = new \App\Book();
     $book->find($id)->delete();
     //$book->delete();
     return redirect('books');
 }
コード例 #2
0
 function getExample6()
 {
     $book = new \App\Book();
     $book_to_update = $book->find(1);
     $book_to_update->title = 'Green Eggs adn Ham';
     $book_to_update->save();
     return 'Example  6';
 }
コード例 #3
0
 function getExample5()
 {
     $book = new \App\Book();
     $harry_potter = $book->find(8);
     $harry_potter->delete();
 }
コード例 #4
0
ファイル: routes.php プロジェクト: satriowisnugroho/LIST
Route::get('login', ['uses' => 'LoginController@index', 'middleware' => 'login']);
Route::group(['middleware' => 'admin', 'prefix' => 'admin'], function () {
    Route::get('/', 'AdminController@index');
    Route::resource('users', 'UserController');
    Route::get('profile', 'UserController@editProfile');
    Route::put('profile/update/{id}', ['as' => 'profile.admin', 'uses' => 'UserController@updateProfile']);
    Route::resource('books', 'BookController');
    Route::get('users/reset/{id}', 'UserController@reset');
});
Route::group(['middleware' => 'operator', 'prefix' => 'operator'], function () {
    Route::get('/', ['as' => 'op', 'uses' => 'OperatorController@index']);
    Route::resource('users', 'UserController');
    Route::get('profile', 'UserController@editProfile');
    Route::put('profile/update/{id}', ['as' => 'profile.operator', 'uses' => 'UserController@updateProfile']);
    Route::get('users/reset/{id}', 'UserController@reset');
    Route::resource('borrow', 'BorrowController');
    Route::resource('books', 'BookController');
    Route::get('order', 'OrderController@index');
    Route::get('order/{id}', 'OrderController@process');
    Route::resource('transactions', 'TransactionController');
});
Route::group(['middleware' => 'member'], function () {
    Route::get('books/order/{id}', ['as' => 'order', 'uses' => 'OrderController@order']);
    Route::put('/profile/update/{id}', ['as' => 'profile.member', 'uses' => 'UserController@updateName']);
    Route::put('users/{id}', 'UserController@updateProfile');
});
Route::get('image/{id}', function ($id) {
    $book = App\Book::find($id);
    $img = Image::make(asset('images/cover/' . $book->cover))->resize(268, 249);
    return $img->response('jpg');
});