Ejemplo n.º 1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $subbreddit = new \App\Subbreddit();
     $subbreddit->user_id = \Auth::user()->id;
     $subbreddit->name = $request->name;
     $subbreddit->description = $request->description;
     $subbreddit->save();
     return $subbreddit;
 }
Ejemplo n.º 2
0
 /**
  * Store a newly created resource in storage.
  * Subbreddits have user_id, title, description
  * Fix: my subbreddits have title and not name!!
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $subbreddit = new \App\Subbreddit();
     $subbreddit->user_id = \Auth::user()->id;
     // changing $request to \Auth::
     $subbreddit->title = $request->title;
     // change name to title
     $subbreddit->description = $request->description;
     $subbreddit->save();
     return $subbreddit;
 }