| 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('search/getAuthors', 'SearchController@getAuthors'); Route::get('/', 'SearchController@getBooks')->name('home'); //HOME Route::get('/book/create', ['middleware' => 'auth.role:1', function () { $publishers = ['' => ''] + \App\Publisher::lists('publisher', 'id')->all(); $collections = ['' => ''] + \App\Collection::lists('collection', 'id')->all(); $publishers[0] = 'Outros'; return view('book/create', ['publishers' => $publishers, 'collections' => $collections]); }]); Route::get('/book/edit/{id}', ['middleware' => 'auth.role:1', function ($id) { $book = \App\Book::find($id); $publishers = ['' => ''] + \App\Publisher::lists('publisher', 'id')->all(); $collections = ['' => ''] + \App\Collection::lists('collection', 'id')->all(); $publishers[0] = 'Outros'; return view('book/edit', ['book' => $book, 'publishers' => $publishers, 'collections' => $collections]); }]); Route::get('/book/list', ['middleware' => 'auth.role:1', function () { $books = App\Book::where('id_user', '=', Auth::user()->id)->where('active', 1)->get(); return view('book/list', ['books' => $books]); }]); Route::get('/book/return/{id}', ['middleware' => 'auth.role:1', function ($id) { $returns = new App\Returns(); $returns->rental_id = $id; $returns->save(); return back(); }]); Route::get('/book/returnConfirmed/{id}', ['middleware' => 'auth.role:1', function ($id) {
/** * Show the form for editing the specified resource. * * @param $id * @return $this */ public function edit($id) { $books = Book::findOrFail($id); $bindings = Binding::lists('binding_type', 'id'); $categories = Categories::lists('category_type', 'id'); $conditions = Condition::lists('condition_type', 'id'); $editions = Edition::lists('edition_type', 'id'); $publishers = Publisher::lists('publishers', 'id'); $rarities = Rarity::lists('rarity_type', 'id'); $signatures = Signature::lists('type', 'id'); return view('admin.library.edit')->with('books', $books)->with('bindings', $bindings)->with('categories', $categories)->with('conditions', $conditions)->with('editions', $editions)->with('publishers', $publishers)->with('rarities', $rarities)->with('signatures', $signatures); }