コード例 #1
0
ファイル: UserController.php プロジェクト: DevTrad/tradbiz
 /**
  * Show user's dashboard
  *
  * @return Response
  */
 public function dashboard()
 {
     $businesses = Business::where('owner_id', '=', Auth::user()->id)->get();
     return view('users.dashboard', ['title' => 'Welcome, ' . Auth::user()->first_name . ' ' . Auth::user()->last_name, 'businesses' => $businesses]);
 }
コード例 #2
0
 /**
  * Show user's dashboard
  *
  * @return Response
  */
 public function dashboard()
 {
     $businesses = Business::where('owner_id', '=', Auth::user()->id)->get();
     return view('users.dashboard', ['businesses' => $businesses]);
 }
コード例 #3
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']);
 }
コード例 #4
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $review = Review::find($id);
     $business = Business::where('id', '=', $review->business_id)->first();
     $average_rating = Review::where('business_id', '=', $business->id)->avg('rating');
     $business->average_rating = round($average_rating, 1);
     $business->save();
     $review->delete();
     return Redirect::route('businesses.show', $business->slug);
 }
コード例 #5
0
 /**
  * Flag as inappropriate
  *
  * @param  int  $id
  * @return Response
  */
 public function flag($id)
 {
     $flagger = Auth::user()->username;
     $business = Business::find($id);
     Mail::send('emails.admin.flag', ['flagger' => $flagger, 'business' => $business, 'extra_comments' => ''], function ($message) {
         $message->to('*****@*****.**', 'Mark Fischer')->subject('TradBiz - A business has been flagged.');
     });
     return view('businesses.flagged');
 }