public function storepost(PostFormRequest $request) { $post = new Post(); $post->title = $request->get('title'); $post->url = $request->get('url'); $post->sub_id = Sub::where('name', $request->get('sub'))->first()->id; $post->user_id = \Auth::id(); $post->save(); return \Redirect::to('/'); }
public function frontpage() { return view('sub')->with('title', 'Front Page')->with('posts', Post::paginate(15)); }