Route::get('/resep/delete/{id}', 'ResepController@delete'); Route::get('/resep/detail/{id}', 'ResepController@detail'); Route::get('/somerouteshere', 'ResepController@index'); Route::get('/somerouteshere/create', 'ResepController@create'); Route::post('/somerouteshere/create', array('before' => 'csrf', 'uses' => 'ResepController@create')); Route::get('/somerouteshere/update/{id}', 'ResepController@update'); Route::post('/somerouteshere/update/{id}', array('before' => 'csrf', 'uses' => 'ResepController@update')); Route::get('/somerouteshere/delete/{id}', 'ResepController@delete'); Route::get('/koki-auto-create', function () { for ($i = 0; $i < 10; $i++) { \App\Models\Koki::create(['nama' => 'koki' . $i, 'kode' => 'ko' . $i]); } }); Route::get('/koki-resep-auto', function () { for ($i = 0; $i < 10; $i++) { for ($j = 0; $j < 5; $j++) { \App\Models\Resep::create(['koki_id' => $i + 1, 'nama' => 'resepmilikkoki_' . $i . 'nomer' . $j]); } } }); Route::get('/generate-bahan', function () { $bahans = ['tepung', 'gula', 'telur', 'garam', 'mentega', 'ayam']; foreach ($bahans as $bahan) { \App\Models\Bahan::create(['nama' => $bahan]); } }); Route::get('drop-create-database', function () { $db = DB::connection()->getDatabaseName(); DB::statement('DROP DATABASE `' . $db . '`'); DB::statement('CREATE DATABASE `' . $db . '`'); });
public function delete($id) { $item = Resep::find($id); $item->delete(); return redirect('resep'); }
public function detail($id) { $item = Resep::findOrFail($id); return view('resep.detail', compact('item')); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function delete($id) { // $item = Resep::find($id); $item->delete(); return redirect('bahan'); }