Example #1
0
 public function update($id, Requests\ArticleTypeRequest $request)
 {
     $articleType = ArticleType::findOrFail($id);
     $articleType->update($request->all());
     //  flash()->overlay('Article Type has been updated.','>Good Job');
     flash()->success('Article Type has been updated.');
     return redirect('article_types');
 }
Example #2
0
 /**
  * Function for changing the Article Type into the Article Type Name.
  *
  * @param $value
  * @return
  */
 public function getTypeAttribute($value)
 {
     $value = ArticleType::where('id', $value)->firstOrFail()->name;
     return $value;
 }
Example #3
0
 public function carSearch()
 {
     $article_type_car = ArticleType::where('code', 'C')->get()->first();
     $articles = Article::all()->where('article_type_id', $article_type_car->id)->where('public', 1);
     return view('online_shop.CarsSearch.carSearch')->with(compact('articles'))->with('viewName', $article_type_car);
 }
Example #4
0
 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'));
 }
Example #5
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     //
     $article_types = ArticleType::where('status', '<>', 2)->get();
     $article = Article::find($id);
     $article->content = str_replace('"', '', $article->content);
     $article->tag = array_filter(explode("×,", $article->tag));
     return view('admin/article/edit')->with('article', $article)->with('article_types', $article_types);
 }
Example #6
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     /*Codes required P and C */
     ArticleType::create(['name' => 'Automóveis Reciclados', 'code' => 'C']);
     ArticleType::create(['name' => 'Peças Recicladas', 'code' => 'P']);
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     //
     $articleType = ArticleType::find($id);
     $articleType->status = 2;
     if ($articleType->save()) {
         return Redirect::to('Admin/Article/type');
     } else {
         return Redirect::back()->withInput()->withErrors('保存失败!');
     }
 }