示例#1
0
 public function viewAs(Request $request)
 {
     $id = $request->input('user_id');
     $user = User::find($id);
     $this->setCurrentUser($user);
     \Toastr::warning($user->username, 'Viewing as...');
     return redirect()->back();
 }
示例#2
0
 /**
  * Show the form for editing the specified staff.
  *
  * @param  int  $id
  * @return \Response
  */
 public function edit($id)
 {
     $staff = User::find($id);
     return \View::make('staffs.edit', compact('staff'));
 }
示例#3
0
 /**
  * Show all of the message threads to the user.
  *
  * @return mixed
  */
 public function index()
 {
     $currentUserId = $this->currentUser()->id;
     $user = User::find($currentUserId)->with('threads', 'threads.messages', 'threads.participants', 'threads.messages.user')->first();
     return view('messenger.index', compact('user', 'currentUserId'));
 }
 /**
  * Bootstrap the application services.
  *
  * @return void
  */
 public function boot()
 {
     view()->composer('helpers.job-timer', function ($view) {
         $view->with('jobs', User::find(auth()->id())->activeJobs()->with('customer', 'guitars', 'items', 'timer')->get());
     });
 }
示例#5
0
 public function addStaff($job_id, $staff_id)
 {
     $percent = request('percent');
     $job = Jobs::with('staff')->find($job_id);
     if ($job->staff->contains($staff_id)) {
         return \Response::json(['error' => 'Already exists', 405]);
     }
     $staff = User::find($staff_id);
     $job->staff()->attach($staff_id, compact('percent'));
     return $staff;
 }