id : false; } public static function getName($id = false) { $user = $id ? self::get($id) : self::getUser(); return $user->first_name.' '.$user->last_name; } public static function getUsername($id = false) { return $id ? self::get($id)->username : self::getUser()->username; } public static function getUser() { return Auth::user(); } public static function isConnected() { return Auth::check(); } public static function getOptions() { return User::orderBy('name')->pluck('name', 'id')->toArray(); } public static function selectOptions() { return User::select('id', DB::raw("concat(last_name,' ',first_name) as name")); } public static function getByUsername($username) { return User::byUsername($username)->withTrashed()->first(); } public static function toggleActive($id, $active) { return self::get($id)->update(['active' => $active]); } public static function updatePassword($id, $password) { $password = Hash::make($password); return User::find($id)->update(['password' => $password]); } public static function getModel() { return User::query(); } }