/** * Store a newly created resource in storage. * * @return Response */ public function store() { //Grab all the data we need to instead into the row $auth = new Auth(); $user_id = $auth::user()->id; $input = Input::all(); $param = array("user_id" => $user_id, "title" => $input['title'], "body" => $input['body']); //Create the row in the database Blog::create($param); return Redirect::route('blogs.index')->with('message', 'Blog created'); }
/** * fetches every blogs. * * @return [type] [description] */ public function index() { return Blog::all(); }
public function store(Request $request) { $blogData = $request->all(); $blog = Blog::create(['title' => $blogData['title'], 'content' => $blogData['content']]); }