public function post(Requests\CreatePostRequest $request)
 {
     $title = input::get('title');
     $body = input::get('body');
     $id = Auth::user()->id;
     Post::create(['title' => $title, 'body' => $body, 'user_id' => $id, 'created_at' => Carbon::now()]);
     return redirect::back();
 }
示例#2
0
 public function sendEmailReminder()
 {
     $validate = validateuser::validateforgot(Request::all());
     if ($validate->passes()) {
         $count = Member::where('email', '=', Request::input('email'))->count();
         if ($count == 1) {
             $forgot_code = sendmail::generateRandomString();
             $sforgot_code = MD5($forgot_code);
             Mail::send('Member.mailforgot', array('code' => $sforgot_code), function ($message) {
                 $message->to(Request::input('email'))->subject('Your Reminder!');
             });
             return redirect::to('/');
         } else {
             $msg = "Not found email!";
             return redirect::to('forgot')->withInput(Request::except('password'))->withErrors($msg);
         }
     } else {
         return redirect::to('forgot')->withInput(Request::except('password'))->withErrors($validate->messages());
     }
 }
示例#3
0
 public function post(Requests\CreatePostRequest $request)
 {
     Auth::user()->posts()->create($request->all());
     return redirect::back();
 }