function getAdd() { $type = new \App\Type(); $type->type = 'Sushi'; $type->fc_adj = 0.07000000000000001; $type->lc_adj = -0.1; $type->save(); foreach ($type->all() as $type) { echo $type->type; } }
function navPrevNextwithType($id = 0, $model = "") { $data = $model::findOrfail($id); $checkNext = $model::orderBy('id', 'desc')->first(); // Ngecek data yang di show paling akhir atau engga // Kalau dia paling akhir maka tombol Next akan di Disabled if ($checkNext->id == $id) { $next = 0; } else { $next = $id + 1; while (is_null($model::find($next))) { $next++; } } // Ngecek data yang di show paling awal atau engga // Kalau dia paling awal maka tombol Prev akan di Disabled $checkPrev = $model::first(); if ($checkPrev->id == $id) { $prev = 0; } else { $prev = $id - 1; while (is_null($model::find($prev))) { $prev--; } } $tipe = App\Type::all(); return $array = array('data' => $data, 'prev' => $prev, 'next' => $next, 'tipe' => $tipe); }
| | 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. | */ // Front End Controller Route::resource('/', 'frontEndController'); // Produk FrontEnd Route Route::get('productFront', 'frontEndController@Produkpage'); // Produk FrontEnd Route Route::get('productFront/{id}', 'frontEndController@ProdukDetail'); // Produk FrontEnd Filter Route::get('productFront/tipe/{id}', function ($id = 0) { $produk = App\Type::find($id)->produk()->where('type_id', '=', $id)->get(); $tipe = App\Type::all(); return view('FrontEnd.product', compact('produk', 'tipe')); }); // News FrontEnd Route Route::get('news', 'frontEndController@newsPage'); // Gallery FrontEnd Route Route::get('gallery', 'frontEndController@galleryPage'); // News Detail FrontEnd Route Route::get('news/{id}', 'frontEndController@newsDetail'); // Contact Us Route Route::get('contactUs', 'frontEndController@contactUs'); //Send Message from Contact Us Page Route::post('sendMessage', 'frontEndController@sendMessage'); // About us Route Route::get('aboutus', 'frontEndController@aboutUs'); // Authentication routes...