public function update(Request $request, $user_id)
 {
     $user = User::findOrFail($user_id);
     if ($request->user()->cannot('update-user-location', $user)) {
         abort(403);
     }
     $this->validate($request, ['location_lat' => 'required', 'location_long' => 'required']);
     return $this->repository->update($user, $request->all());
 }
 public function updateLocation(Request $request, $id)
 {
     $user = User::findOrFail($id);
     if ($request->user()->cannot('update-user-location', $user)) {
         abort(403);
     }
     $user = $this->repository->updateLocation($user, $request->all());
     return $user;
 }
 public function sendEmailInvite($idUser)
 {
     $user = User::findOrFail($idUser);
     try {
         Mail::send('emails.invite', ['user' => $user], function ($m) use($user) {
             $m->from(env('MAIL_SENDER'), 'fleetany sender');
             $m->to($user->email, $user->name)->subject('fleetany invitation');
         });
     } catch (\Exception $e) {
         Log::info($e->getMessage());
     }
 }
 public function testSendEmailInvite()
 {
     \Illuminate\Support\Facades\Request::setSession($this->app['session.store']);
     $user = User::findOrFail(1);
     Mail::shouldReceive('send')->once()->andReturn(function ($message) {
         $this->assertEquals('fleetany invitation', $message->getSubject());
         $this->assertEquals($user->email, $message->getTo());
         $this->assertEquals(View::make('emails.invite'), $message->getBody());
     });
     try {
         $repo = new UserRepositoryEloquent(new Application());
         $userController = new InviteController($repo);
         $userController->sendEmailInvite($user->id);
     } catch (\Exception $e) {
         echo $e->getMessage();
     }
 }
 public function find($id)
 {
     return User::findOrFail($id);
 }
Beispiel #6
0
 /**
  * Send an e-mail reminder to the user.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function sendEmailReminder(Request $request, $id)
 {
     $user = User::findOrFail($id);
     Mail::send('emails.reminder', ['user' => $user], function ($m) use($user) {
         $m->from('*****@*****.**', 'Your Application');
         $m->to($user->email, $user->name)->subject('Your Reminder!');
     });
 }
 public function showProfile()
 {
     $user = User::findOrFail(Auth::id());
     $language = $user->getAvailableLanguages();
     return view("profile", compact('user', 'language'));
 }