-
app/Helpers/Qs.php
Open in GitHubclass Qs { // public static function getDefaultUserImage() { return asset('global_assets/images/user.png'); } public static function getTeamSA() { return ['admin', 'super_admin']; } // public static function getStaff($remove=[]) { $data = ['super_admin', 'admin', 'teacher', 'accountant', 'librarian']; return $remove ? array_values(array_diff($data, $remove)) : $data; } public static function getStaffRecord($remove = []) { $data = ['emp_date',]; return $remove ? array_values(array_diff($data, $remove)) : $data; } // }
-
app/Http/Controllers/SupportTeam/UserController.php
Open in GitHubuse App\Helpers\Qs; class UserController extends Controller { // public function store(UserRequest $req) { $user_type = $this->user->findType($req->user_type)->title; $data = $req->except(Qs::getStaffRecord()); $data['name'] = ucwords($req->name); $data['user_type'] = $user_type; $data['photo'] = Qs::getDefaultUserImage(); $data['code'] = strtoupper(Str::random(10)); $user_is_staff = in_array($user_type, Qs::getStaff()); $user_is_teamSA = in_array($user_type, Qs::getTeamSA()); // } //