Esempio n. 1
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next, $permission)
 {
     if ($this->auth->user()->cannot($permission)) {
         $this->flash->error('No access.');
         return Redirect::action('PagesController@index');
     }
     return $next($request);
 }
 /**
  * Store form for editing the user's password.
  *
  * @param int $id
  * @return \Illuminate\Http\Response
  */
 public function postChangePassword(ChangePasswordRequest $request, $id, FlashHelper $flash)
 {
     $user = User::whereId($id)->first();
     $user->update(['password' => bcrypt(Input::get('password'))]);
     $user->save();
     $flash->success('Password has been changed.');
     return Redirect::action('Admin\\AdminUsersController@show', ['id' => $user->id]);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  RegionRequest  $request
  * @param  FlashHelper    $flash
  * @return Response
  */
 public function store(RegionRequest $request, FlashHelper $flash)
 {
     $region = $this->user->publish(new Region($request->all()));
     $flash->success('Success');
     return redirect($region->path());
 }
Esempio n. 4
0
 /**
  * @param  string       $token
  * @param  FlashHelper  $flash
  * @return \Illuminate\Http\Response
  */
 public function verify(FlashHelper $flash, $token)
 {
     User::whereToken($token)->firstOrFail()->confirmEmail();
     $flash->success('Your account has been verified.');
     return Redirect::action('PagesController@index');
 }