/** * Run the database seeds. * * @return void */ public function run() { Marque::create(['idMarq' => 1, 'nomMarq' => 'Renault']); Marque::create(['idMarq' => 2, 'nomMarq' => 'Honda']); Marque::create(['idMarq' => 3, 'nomMarq' => 'Peugeot']); Marque::create(['idMarq' => 4, 'nomMarq' => 'Citroën']); Marque::create(['idMarq' => 5, 'nomMarq' => 'Audi']); Marque::create(['idMarq' => 6, 'nomMarq' => 'BMW']); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $types = Type::all(); $marques = Marque::all(); $modeles = Modele::all(); $couleurs = Couleur::all(); $vehicule = Vehicule::find($id); $idMarque = DB::table('modele')->join('marque', 'marque.marque_id', '=', 'modele.marque_id')->select('marque.marque_id')->where('modele.modele_id', $vehicule->modele_id)->get()[0]->marque_id; $idType = DB::table('marque')->join('type', 'type.type_id', '=', 'marque.type_id')->select('type.type_id')->where('marque.marque_id', $idMarque)->get()[0]->type_id; return view('dashboard.profile.vehicule.edit_car', ['types' => $types, 'marques' => $marques, 'marqueCourante' => $idMarque, 'modeles' => $modeles, 'typeCourant' => $idType, 'couleurs' => $couleurs, 'vehicule' => $vehicule]); }
public function getList() { $modeles = Modele::all(); $marques = Marque::all(); return view('backoffice.modeles', compact("modeles", "marques")); }
public function add(Request $request) { $marque = Marque::create(['nomMarq' => $request->input('nomMarq')]); $marque->save(); return redirect()->route('backMarq'); }