fixing styles
This commit is contained in:
@@ -5,6 +5,7 @@ namespace App\Repositories\Core\Auth;
|
||||
use App\Models\Core\Auth\RoleUser;
|
||||
use App\Models\Core\Auth\User;
|
||||
use App\Repositories\Core\Upload;
|
||||
use App\Traits\Model\Basic;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
@@ -14,7 +15,7 @@ use Laratrust\Traits\LaratrustUserTrait;
|
||||
|
||||
class Users
|
||||
{
|
||||
use LaratrustUserTrait;
|
||||
use Basic, LaratrustUserTrait;
|
||||
|
||||
public static function isAdmin()
|
||||
{
|
||||
@@ -59,22 +60,6 @@ class Users
|
||||
return $user;
|
||||
}
|
||||
|
||||
public static function update($data, $id = false)
|
||||
{
|
||||
$id = $id ? $id : $data['id'];
|
||||
$user = self::get($id);
|
||||
$ret = $user->update($data);
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
public static function get($id = false)
|
||||
{
|
||||
$id = $id ? $id : self::getId();
|
||||
|
||||
return User::findOrFail($id);
|
||||
}
|
||||
|
||||
public static function getId()
|
||||
{
|
||||
$user = self::getUser();
|
||||
@@ -206,32 +191,12 @@ class Users
|
||||
return User::select('id', DB::raw("concat(last_name,' ',first_name) as name"));
|
||||
}
|
||||
|
||||
public static function count()
|
||||
{
|
||||
return User::count();
|
||||
}
|
||||
|
||||
public static function select_all_by_status_id($status_id)
|
||||
{
|
||||
return User::byStatus($status_id);
|
||||
}
|
||||
|
||||
public static function select_by_id($user_id)
|
||||
{
|
||||
return User::with('status')->find($user_id)->toArray();
|
||||
}
|
||||
|
||||
public static function select_by_name($name)
|
||||
{
|
||||
return self::getByName($name)->toArray();
|
||||
}
|
||||
|
||||
public static function getByUsername($username)
|
||||
{
|
||||
return User::byUsername($username)->withTrashed()->first();
|
||||
}
|
||||
|
||||
public static function toggle_active($id, $active)
|
||||
public static function toggleActive($id, $active)
|
||||
{
|
||||
return self::get($id)->update(['active' => $active]);
|
||||
}
|
||||
@@ -249,12 +214,12 @@ class Users
|
||||
];
|
||||
}
|
||||
|
||||
public static function update_avatar($id, $avatar)
|
||||
public static function updateAvatar($id, $avatar)
|
||||
{
|
||||
return User::find($id)->update(['avatar' => $avatar]);
|
||||
}
|
||||
|
||||
public static function update_password($id, $password)
|
||||
public static function updatePassword($id, $password)
|
||||
{
|
||||
$password = Hash::make($password);
|
||||
|
||||
@@ -265,4 +230,9 @@ class Users
|
||||
{
|
||||
return PasswordRules::changePassword($username, $field);
|
||||
}
|
||||
|
||||
public static function getModel()
|
||||
{
|
||||
return User::query();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user