Ejemplo n.º 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();
 }
Ejemplo n.º 2
0
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 protected function create(array $data)
 {
     return User::create(['username' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]);
 }
Ejemplo n.º 3
0
 /**
  * @return array
  */
 protected function getUserOptionsForSelect()
 {
     $users = User::where('id', '<>', \Auth::id())->orderBy('username')->lists('username', 'id')->toArray();
     $defaultUsers = [\Auth::id() => 'Myself', 'any' => 'Any staff member', '' => '---------------------'];
     $typeOptions = ['General' => 'General', 'Contact' => 'Contact', 'Billing' => 'Billing'];
     $userOptions = $defaultUsers + $users;
     return array($typeOptions, $userOptions);
 }
Ejemplo n.º 4
0
 /**
  * Remove the specified staff from storage.
  *
  * @param  int  $id
  * @return \Response
  */
 public function destroy($id)
 {
     User::destroy($id);
     return \Redirect::route('staffs.index');
 }
Ejemplo n.º 5
0
 /**
  * Creates a new message thread.
  *
  * @return mixed
  */
 public function create()
 {
     $users = User::where('id', '!=', Auth::id())->get();
     return view('messenger.create', compact('users'));
 }
 /**
  * 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());
     });
 }
 /**
  * Bootstrap the application services.
  *
  * @return void
  */
 public function boot()
 {
     view()->composer('helpers.view-as', function ($view) {
         $view->with('users', User::all()->lists('username', 'id'));
     });
 }
Ejemplo n.º 8
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;
 }
Ejemplo n.º 9
0
 Route::resource('jobs.staff', 'StaffsController');
 Route::resource('jobs.guitars', 'GuitarsController');
 Route::resource('events', 'EventsController');
 Route::resource('parts', 'PartsController');
 Route::resource('tasks', 'TasksController');
 Route::resource('services', 'ServicesController');
 Route::resource('customers', 'CustomersController');
 Route::post('parts/multi', 'PartsController@multi');
 Route::post('services/multi', 'ServicesController@multi');
 Route::post('customers/multi', 'CustomersController@multi');
 Route::post('tasks/multi', 'TasksController@multi');
 Route::post('jobs/update-timers', 'JobsController@updateTimers');
 Route::get('jobs/{id}/changelog', 'JobsController@changelog');
 Route::get('tasks/{task}/completed/{completed}', 'TasksController@completed');
 Route::get('staff', function () {
     return \NodenDb\User::all();
 });
 Route::group(['prefix' => 'calender'], function () {
     Route::get('/jobs', function () {
         return Jobs::active()->get()->values();
     });
     Route::get('/tasks', function () {
         return Tasks::where('task_user_id', auth()->id())->orWhere('Scope', 'Everyone')->todo()->get()->values();
     });
     Route::get('/events/public', function () {
         return Events::recent()->pub()->get()->values();
     });
     Route::get('/events/private', function () {
         return Events::recent()->pri()->get()->values();
     });
 });