public function bespoke() { $twitter = $this->getTweets("BoyardeLovesArt"); $articles = article::where('category_id', 4)->orderby('id', 'desc')->first(); dd($articles); return view('fashion.bespoke', compact('articles', 'twitter')); }
/** * Show the application welcome screen to the user. * * @return Response */ public function index() { $about = array(''); //$news = array(); $articles = article::all(); foreach ($articles as $article) { //echo $article->type; } $about = \App\article::where('type', '=', 'about')->first(); return view('home')->with('credential', $this->credential)->with('about', $about); }
public function update(Request $request, $id) { $this->validate($request, ['name' => 'required|max:64', 'content' => 'required']); $parms = array(); $parms['name'] = Input::get('name'); $parms['content'] = Input::get('content'); /* $article=article::find($id); $article->name = Input::get('name'); $article->content = Input::get('content'); $article->update(); */ $article = new article(); return $article->where('id', $id)->update($parms) ? Redirect::to('/article') : Redirect::back()->withInput()->withErrors('更新失敗!'); }
public function home() { $articles = article::where('category_id', 1)->orderby('id', 'desc')->get(); return view('home', compact('articles')); /*return view('top',['articles' => $articles]);*/ }
public function getPicture($filename) { $picture = article::where('filename', '=', $filename)->firstOrFail(); $file = Storage::disk('local')->get($picture->filename); return response($file, 200)->header('Content-Type', $picture->mime); }