コード例 #1
0
 public function postNew()
 {
     $link = Request::input('link');
     $section = Request::input('section');
     $subject = Request::input('post_name');
     $content = Request::input('post');
     $user = Session::get('email');
     if (!$subject || !$content) {
         $error = "Please fill in all fields";
         return view('newpost')->with('link', $link)->with('error', $error)->with('subject', $subject)->with('content', $content);
     } else {
         $blog = new Blog();
         $blog->section = $section;
         $blog->link = $link;
         $blog->user = $user;
         $blog->subject = $subject;
         $blog->content = $content;
         $blog->push();
         return redirect('/');
     }
 }