Пример #1
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $business = Business::where('slug', '=', $id)->first();
     $owner = User::find($business->owner_id);
     $reviews = Review::where('business_id', '=', $business->id)->get();
     return view('businesses.show', ['business' => $business, 'owner' => $owner, 'reviews' => $reviews]);
 }
Пример #2
0
 public function activationLookupEmail(Request $request)
 {
     $email = $request->input('email');
     $id = User::where('email', '=', $email)->first()->id;
     return Redirect::to('resend/' . $id);
 }
Пример #3
0
 /**
  * Send user an activation email
  *
  *
  */
 public function sendActivationEmail()
 {
     Mail::send('emails.auth.activate', ['id' => User::where('username', '=', $this->username)->first()->id, 'token' => $this->activation_token], function ($message) {
         $message->to($this->email, $this->first_name . ' ' . $this->last_name)->subject('Activate your TradBiz account');
     });
 }
Пример #4
0
 /**
  * Flag as inappropriate
  *
  * @param  int  $id
  * @return Response
  */
 public function flag($id)
 {
     $flagger = Auth::user()->username;
     $business = Business::find($id);
     $users = User::all();
     $adminEmails = [];
     foreach ($users as $user) {
         if ($user->isAdmin()) {
             array_push($adminEmails, $user->email);
         }
     }
     Mail::send('emails.admin.flag', ['flagger' => $flagger, 'business' => $business, 'extra_comments' => ''], function ($message) use($adminEmails) {
         $message->to($adminEmails, null)->subject('TradBiz - A business has been flagged.');
     });
     return view('businesses.flagged', ['title' => 'Business Flagged Successfully']);
 }