fixing styles
This commit is contained in:
@@ -41,7 +41,7 @@ class Roles
|
||||
return $role;
|
||||
}
|
||||
|
||||
public static function toggle_active($id, $active)
|
||||
public static function toggleActive($id, $active)
|
||||
{
|
||||
return Role::find($id)->update(['active' => $active]);
|
||||
}
|
||||
|
||||
@@ -5,12 +5,12 @@ namespace App\Repositories\Core\Auth;
|
||||
use App\Models\Core\Auth\Team;
|
||||
use App\Models\Core\Auth\TeamUser;
|
||||
use App\Repositories\Users;
|
||||
use App\Traits\Model\Basic;
|
||||
use Laratrust\Traits\LaratrustUserTrait;
|
||||
use Yajra\DataTables\DataTables;
|
||||
|
||||
class Teams
|
||||
{
|
||||
use LaratrustUserTrait;
|
||||
use Basic, LaratrustUserTrait;
|
||||
|
||||
public static function getTeamsByUser($user_id = false)
|
||||
{
|
||||
@@ -34,48 +34,11 @@ class Teams
|
||||
return Team::find($id)->users();
|
||||
}
|
||||
|
||||
public static function getOptions()
|
||||
{
|
||||
return Team::orderBy('name', 'asc')->get()->pluck('name', 'id')->toArray();
|
||||
}
|
||||
|
||||
public static function getInfo($id)
|
||||
{
|
||||
return Team::find($id);
|
||||
}
|
||||
|
||||
public static function select_all()
|
||||
{
|
||||
return self::getAll()->toArray();
|
||||
}
|
||||
|
||||
public static function select_by_id($id)
|
||||
{
|
||||
return Team::find($id)->toArray();
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
{
|
||||
return Team::orderBy('name', 'asc')->get();
|
||||
}
|
||||
|
||||
public static function getByName($name)
|
||||
{
|
||||
return Team::where('name', $name)->first();
|
||||
}
|
||||
|
||||
public static function get($id)
|
||||
{
|
||||
return Team::find($id);
|
||||
}
|
||||
|
||||
public static function getTable($id)
|
||||
{
|
||||
$datas = Team::with(['societe'])->withCount(['users']);
|
||||
|
||||
return Datatables::of($datas)->make(true);
|
||||
}
|
||||
|
||||
public static function delete($id)
|
||||
{
|
||||
Users::destroyByUniqueTeam($id);
|
||||
@@ -91,32 +54,8 @@ class Teams
|
||||
}
|
||||
}
|
||||
|
||||
public static function store($data)
|
||||
public static function getModel()
|
||||
{
|
||||
if (isset($data['id']) && $data['id']) {
|
||||
return self::update($data);
|
||||
}
|
||||
|
||||
return self::create($data);
|
||||
}
|
||||
|
||||
public static function create($data)
|
||||
{
|
||||
return Team::create($data);
|
||||
}
|
||||
|
||||
public static function update($data)
|
||||
{
|
||||
return Team::find($data['id'])->update($data);
|
||||
}
|
||||
|
||||
public static function count()
|
||||
{
|
||||
return Team::count();
|
||||
}
|
||||
|
||||
public static function toggle_active($id, $active)
|
||||
{
|
||||
return Team::find($id)->update(['active' => $active]);
|
||||
return Team::query();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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