/** * Bootstrap any application services. * * @return void */ public function boot() { User::creating(function ($user) { $user->created_by = Auth::user()->id; }); User::updating(function ($user) { if (isset(Auth::user()->id)) {
static function getUserList() { $userList = User::all()->toArray(); //echo '<pre>'; print_r($userList); echo '</pre>'; exit; //dd(User::all()); foreach ($userList as $key => $user) { //echo $key; //echo '<pre>'; print_r($user); echo '</pre>'; //exit; $scanEnds = Scan::getScanEnds($user['id']); //echo '<pre>'; print_r($scanEnds); echo '</pre>'; exit; $userList[$key]['last_scan'] = $scanEnds[0]->last_scan; $userList[$key]['first_scan'] = $scanEnds[0]->first_scan; } return $userList; }
/** * Create a new user instance after a valid registration. * * @param array $data * @return User */ protected function create(array $data) { return User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]); }