/** * Run the database seeds. * * @return void */ public function run() { $brand = Brand::create(['name' => 'Opel', 'code' => '']); BrandModel::create(['name' => 'Corsa', 'code' => '', 'brand_id' => $brand->id]); BrandModel::create(['name' => 'Vectra', 'code' => '', 'brand_id' => $brand->id]); BrandModel::create(['name' => 'Insignia', 'code' => '', 'brand_id' => $brand->id]); BrandModel::create(['name' => 'Astra', 'code' => '', 'brand_id' => $brand->id]); BrandModel::create(['name' => 'Mondeo', 'code' => '', 'brand_id' => $brand->id]); $brand = Brand::create(['name' => 'Audi', 'code' => '']); BrandModel::create(['name' => 'A1', 'code' => '', 'brand_id' => $brand->id]); BrandModel::create(['name' => 'A2', 'code' => '', 'brand_id' => $brand->id]); BrandModel::create(['name' => 'A3', 'code' => '', 'brand_id' => $brand->id]); BrandModel::create(['name' => 'A4', 'code' => '', 'brand_id' => $brand->id]); BrandModel::create(['name' => 'A5', 'code' => '', 'brand_id' => $brand->id]); BrandModel::create(['name' => 'TT', 'code' => '', 'brand_id' => $brand->id]); BrandModel::create(['name' => 'A6', 'code' => '', 'brand_id' => $brand->id]); BrandModel::create(['name' => 'A7', 'code' => '', 'brand_id' => $brand->id]); BrandModel::create(['name' => 'A8', 'code' => '', 'brand_id' => $brand->id]); $brand = Brand::create(['name' => 'Renault', 'code' => '']); BrandModel::create(['name' => 'Clio', 'code' => '', 'brand_id' => $brand->id]); BrandModel::create(['name' => 'Espace', 'code' => '', 'brand_id' => $brand->id]); BrandModel::create(['name' => 'Kangoo', 'code' => '', 'brand_id' => $brand->id]); BrandModel::create(['name' => 'Megane', 'code' => '', 'brand_id' => $brand->id]); BrandModel::create(['name' => 'Laguna', 'code' => '', 'brand_id' => $brand->id]); BrandModel::create(['name' => 'Modus', 'code' => '', 'brand_id' => $brand->id]); BrandModel::create(['name' => 'Fluence', 'code' => '', 'brand_id' => $brand->id]); BrandModel::create(['name' => 'Captur', 'code' => '', 'brand_id' => $brand->id]); $brand = Brand::create(['name' => 'Fiat', 'code' => '']); $brand = Brand::create(['name' => 'BMW', 'code' => '']); $brand = Brand::create(['name' => 'Seat', 'code' => '']); }
public function loadImages($id) { $brand = Brand::findorFail($id); $brandModels = BrandModel::where('brand_id', '=', $id)->get(); // get the brand pictures $brandPictures = $brand->pictures()->get(); return view('backoffice.brands.editImages')->with(compact('brand'))->with(compact('brandPictures')); }
/** * Show the application dashboard. * * @return Response */ public function index() { $articleCount = Article::all()->count(); $partTypeCount = PartType::all()->count(); $brandsCount = Brand::all()->count(); $modelCount = BrandModel::all()->count(); // dd($articleCount); return view('home')->with(['articleCount' => $articleCount, 'partTypeCount' => $partTypeCount, 'brandsCount' => $brandsCount, 'modelCount' => $modelCount]); }
public function getAnnotations($model_id) { $result = ['data' => '', 'status' => '', 'message' => '']; $data = []; $status = TRUE; $message = ''; $annotations = BrandModel::join('annotations', 'brand_model.id', '=', 'annotations.model_id')->where('id', $model_id)->select('annotations.slug_name', 'annotations.annotation_name', 'annotations.description', 'annotations.image_url', 'annotations.id')->get(''); foreach ($annotations as $annotation) { $data[$annotation->id] = ['type' => $annotation->slug_name, 'name' => $annotation->annotation_name, 'description' => $annotation->description, 'image' => $annotation->image_url]; } $result['data'] = $data; $result['status'] = $status; $result['message'] = $message; return $result; }
public function store(ArticlesRequest $request) { // set the shop to the shop of the logged user $article = new Article($request->all()); $this->saveArticle($article); flash()->success('Article has been created. You can now enter the Pictures!'); $modelsList = BrandModel::lists('name', 'id')->prepend('(all)', ''); $brandsList = Brand::lists('name', 'id')->prepend('(all)', ''); $partsList = PartType::lists('name', 'id')->prepend('(all)', ''); $articleTypesList = ArticleType::lists('name', 'id')->prepend('(choose one)', ''); // get the brand pictures $articlePictures = $article->pictures()->get(); return view('backoffice.articles.edit')->with(compact('brandsList'))->with(compact('partsList'))->with(compact('modelsList'))->with(compact('article'))->with(compact('articlePictures'))->with(compact('articleTypesList')); }
public function destroy($id) { $model = BrandModel::findOrFail($id); $model->delete(); return \Response::json(['error' => false, 'code' => 200, 'feedback' => 'Model has been deleted.'], 200); }