@@ -17,34 +17,34 @@ discard block |
||
| 17 | 17 | { |
| 18 | 18 | $query = MediaObject::query(); |
| 19 | 19 | |
| 20 | - if($request->has('searchTerm')) { |
|
| 21 | - $columnsToSearch = ['group','titl','obje_id','rin']; |
|
| 20 | + if ($request->has('searchTerm')) { |
|
| 21 | + $columnsToSearch = ['group', 'titl', 'obje_id', 'rin']; |
|
| 22 | 22 | $search_term = json_decode($request->searchTerm)->searchTerm; |
| 23 | - if(!empty($search_term)) { |
|
| 23 | + if (!empty($search_term)) { |
|
| 24 | 24 | $searchQuery = '%' . $search_term . '%'; |
| 25 | - foreach($columnsToSearch as $column) { |
|
| 25 | + foreach ($columnsToSearch as $column) { |
|
| 26 | 26 | $query->orWhere($column, 'LIKE', $searchQuery); |
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - if($request->has('columnFilters')) { |
|
| 31 | + if ($request->has('columnFilters')) { |
|
| 32 | 32 | |
| 33 | 33 | $filters = get_object_vars(json_decode($request->columnFilters)); |
| 34 | 34 | |
| 35 | - foreach($filters as $key => $value) { |
|
| 36 | - if(!empty($value)) { |
|
| 35 | + foreach ($filters as $key => $value) { |
|
| 36 | + if (!empty($value)) { |
|
| 37 | 37 | $query->orWhere($key, 'like', '%' . $value . '%'); |
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - if($request->has('sort.0')) { |
|
| 42 | + if ($request->has('sort.0')) { |
|
| 43 | 43 | $sort = json_decode($request->sort[0]); |
| 44 | 44 | $query->orderBy($sort->field, $sort->type); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - if($request->has("perPage")) { |
|
| 47 | + if ($request->has("perPage")) { |
|
| 48 | 48 | $rows = $query->paginate($request->perPage); |
| 49 | 49 | } |
| 50 | 50 | |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | public function destroy($id) |
| 135 | 135 | { |
| 136 | 136 | $mediaobject = MediaObject::find($id); |
| 137 | - if($mediaobject) { |
|
| 137 | + if ($mediaobject) { |
|
| 138 | 138 | $mediaobject->delete(); |
| 139 | 139 | return "true"; |
| 140 | 140 | } |
@@ -16,34 +16,34 @@ discard block |
||
| 16 | 16 | { |
| 17 | 17 | $query = MediaObjectFile::query(); |
| 18 | 18 | |
| 19 | - if($request->has('searchTerm')) { |
|
| 19 | + if ($request->has('searchTerm')) { |
|
| 20 | 20 | $columnsToSearch = ['name', 'email', 'phone']; |
| 21 | 21 | $search_term = json_decode($request->searchTerm)->searchTerm; |
| 22 | - if(!empty($search_term)) { |
|
| 22 | + if (!empty($search_term)) { |
|
| 23 | 23 | $searchQuery = '%' . $search_term . '%'; |
| 24 | - foreach($columnsToSearch as $column) { |
|
| 24 | + foreach ($columnsToSearch as $column) { |
|
| 25 | 25 | $query->orWhere($column, 'LIKE', $searchQuery); |
| 26 | 26 | } |
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - if($request->has('columnFilters')) { |
|
| 30 | + if ($request->has('columnFilters')) { |
|
| 31 | 31 | |
| 32 | 32 | $filters = get_object_vars(json_decode($request->columnFilters)); |
| 33 | 33 | |
| 34 | - foreach($filters as $key => $value) { |
|
| 35 | - if(!empty($value)) { |
|
| 34 | + foreach ($filters as $key => $value) { |
|
| 35 | + if (!empty($value)) { |
|
| 36 | 36 | $query->orWhere($key, 'like', '%' . $value . '%'); |
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - if($request->has('sort.0')) { |
|
| 41 | + if ($request->has('sort.0')) { |
|
| 42 | 42 | $sort = json_decode($request->sort[0]); |
| 43 | 43 | $query->orderBy($sort->field, $sort->type); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - if($request->has("perPage")) { |
|
| 46 | + if ($request->has("perPage")) { |
|
| 47 | 47 | $rows = $query->paginate($request->perPage); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | public function destroy($id) |
| 144 | 144 | { |
| 145 | 145 | $mediaobjectfile = MediaObjectFile::find($id); |
| 146 | - if($mediaobjectfile) { |
|
| 146 | + if ($mediaobjectfile) { |
|
| 147 | 147 | $mediaobjectfile->delete(); |
| 148 | 148 | return "true"; |
| 149 | 149 | } |
@@ -19,8 +19,8 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | public function forgot(Request $request) { |
| 21 | 21 | $credentials = request()->validate(['email' => 'required|email']); |
| 22 | - $user = User::where ('email', $request->email)->first(); |
|
| 23 | - if ( !$user ) return response()->json(['error' => '404','error_msg' => 'Email not exits in record']); |
|
| 22 | + $user = User::where('email', $request->email)->first(); |
|
| 23 | + if (!$user) return response()->json(['error' => '404', 'error_msg' => 'Email not exits in record']); |
|
| 24 | 24 | $token = $this->generateToken(); |
| 25 | 25 | DB::connection($this->getConnectionName())->table('password_resets')->insert([ |
| 26 | 26 | 'email' => $request->email, |
@@ -52,10 +52,10 @@ discard block |
||
| 52 | 52 | 'password' => 'required|string|confirmed' |
| 53 | 53 | ]); |
| 54 | 54 | $tokenData = DB::connection($this->getConnectionName())->table('password_resets') |
| 55 | - ->where('token', $request->token)->where('email',$request->email)->first(); |
|
| 56 | - if($tokenData) { |
|
| 55 | + ->where('token', $request->token)->where('email', $request->email)->first(); |
|
| 56 | + if ($tokenData) { |
|
| 57 | 57 | $user = User::where('email', $request->email)->first(); |
| 58 | - if($user) { |
|
| 58 | + if ($user) { |
|
| 59 | 59 | $user->password = bcrypt($request->password); |
| 60 | 60 | $user->save(); //or $user->save(); |
| 61 | 61 | DB::connection($this->getConnectionName())->table('password_resets')->where('email', $user->email)->delete(); |
@@ -20,7 +20,9 @@ |
||
| 20 | 20 | public function forgot(Request $request) { |
| 21 | 21 | $credentials = request()->validate(['email' => 'required|email']); |
| 22 | 22 | $user = User::where ('email', $request->email)->first(); |
| 23 | - if ( !$user ) return response()->json(['error' => '404','error_msg' => 'Email not exits in record']); |
|
| 23 | + if ( !$user ) { |
|
| 24 | + return response()->json(['error' => '404','error_msg' => 'Email not exits in record']); |
|
| 25 | + } |
|
| 24 | 26 | $token = $this->generateToken(); |
| 25 | 27 | DB::connection($this->getConnectionName())->table('password_resets')->insert([ |
| 26 | 28 | 'email' => $request->email, |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | // |
| 81 | 81 | $request->validate([ |
| 82 | - 'name' => ['required','unique:landlord.companies'], |
|
| 82 | + 'name' => ['required','unique:landlord.companies'], |
|
| 83 | 83 | |
| 84 | 84 | ]); |
| 85 | 85 | return $user->Company()->create([ |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | { |
| 124 | 124 | // |
| 125 | 125 | $request->validate([ |
| 126 | - 'name' => ['required','unique:landlord.companies'], |
|
| 126 | + 'name' => ['required','unique:landlord.companies'], |
|
| 127 | 127 | |
| 128 | 128 | ]); |
| 129 | 129 | |
@@ -19,37 +19,37 @@ discard block |
||
| 19 | 19 | $companies_id = $user->Company()->pluck('companies.id'); |
| 20 | 20 | $query = Company::query(); |
| 21 | 21 | |
| 22 | - if($request->has('searchTerm')) { |
|
| 22 | + if ($request->has('searchTerm')) { |
|
| 23 | 23 | $columnsToSearch = ['name', 'status']; |
| 24 | 24 | $search_term = json_decode($request->searchTerm)->searchTerm; |
| 25 | - if(!empty($search_term)) { |
|
| 25 | + if (!empty($search_term)) { |
|
| 26 | 26 | $searchQuery = '%' . $search_term . '%'; |
| 27 | - foreach($columnsToSearch as $column) { |
|
| 27 | + foreach ($columnsToSearch as $column) { |
|
| 28 | 28 | $query->orWhere($column, 'LIKE', $searchQuery); |
| 29 | 29 | } |
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - if($request->has('columnFilters')) { |
|
| 33 | + if ($request->has('columnFilters')) { |
|
| 34 | 34 | |
| 35 | 35 | $filters = get_object_vars(json_decode($request->columnFilters)); |
| 36 | 36 | |
| 37 | - foreach($filters as $key => $value) { |
|
| 38 | - if(!empty($value)) { |
|
| 37 | + foreach ($filters as $key => $value) { |
|
| 38 | + if (!empty($value)) { |
|
| 39 | 39 | $query->orWhere($key, 'like', '%' . $value . '%'); |
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - if($request->has('sort.0')) { |
|
| 44 | + if ($request->has('sort.0')) { |
|
| 45 | 45 | $sort = json_decode($request->sort[0]); |
| 46 | 46 | $query->orderBy($sort->field, $sort->type); |
| 47 | 47 | } |
| 48 | 48 | $query->find($companies_id); |
| 49 | - if($request->has("perPage")) { |
|
| 49 | + if ($request->has("perPage")) { |
|
| 50 | 50 | $rows = $query->paginate($request->perPage); |
| 51 | 51 | } |
| 52 | - if(!count($request->all())) { |
|
| 52 | + if (!count($request->all())) { |
|
| 53 | 53 | $rows = $query->get()->toArray(); |
| 54 | 54 | } |
| 55 | 55 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | // |
| 81 | 81 | $request->validate([ |
| 82 | - 'name' => ['required','unique:landlord.companies'], |
|
| 82 | + 'name' => ['required', 'unique:landlord.companies'], |
|
| 83 | 83 | |
| 84 | 84 | ]); |
| 85 | 85 | return $user->Company()->create([ |
@@ -123,11 +123,11 @@ discard block |
||
| 123 | 123 | { |
| 124 | 124 | // |
| 125 | 125 | $request->validate([ |
| 126 | - 'name' => ['required','unique:landlord.companies'], |
|
| 126 | + 'name' => ['required', 'unique:landlord.companies'], |
|
| 127 | 127 | |
| 128 | 128 | ]); |
| 129 | 129 | |
| 130 | - $company=Company::find($id); |
|
| 130 | + $company = Company::find($id); |
|
| 131 | 131 | $company->name = $request->name; |
| 132 | 132 | $company->save(); |
| 133 | 133 | return $company; |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | public function destroy($id) |
| 143 | 143 | { |
| 144 | 144 | // |
| 145 | - $company=Company::find($id); |
|
| 145 | + $company = Company::find($id); |
|
| 146 | 146 | if ($company) { |
| 147 | 147 | $company->delete(); |
| 148 | 148 | return true; |
@@ -129,7 +129,7 @@ |
||
| 129 | 129 | 'is_active' => 'required', |
| 130 | 130 | 'confidence' => 'required', |
| 131 | 131 | 'source_id' => 'required' |
| 132 | - ]); |
|
| 132 | + ]); |
|
| 133 | 133 | |
| 134 | 134 | $citation = Citation::find($id); |
| 135 | 135 | $citation->name = $request->name; |
@@ -16,34 +16,34 @@ discard block |
||
| 16 | 16 | { |
| 17 | 17 | $query = Citation::query(); |
| 18 | 18 | |
| 19 | - if($request->has('searchTerm')) { |
|
| 20 | - $columnsToSearch = ['name', 'description', 'date','is_active','volume','page','confidence','source_id']; |
|
| 19 | + if ($request->has('searchTerm')) { |
|
| 20 | + $columnsToSearch = ['name', 'description', 'date', 'is_active', 'volume', 'page', 'confidence', 'source_id']; |
|
| 21 | 21 | $search_term = json_decode($request->searchTerm)->searchTerm; |
| 22 | - if(!empty($search_term)) { |
|
| 22 | + if (!empty($search_term)) { |
|
| 23 | 23 | $searchQuery = '%' . $search_term . '%'; |
| 24 | - foreach($columnsToSearch as $column) { |
|
| 24 | + foreach ($columnsToSearch as $column) { |
|
| 25 | 25 | $query->orWhere($column, 'LIKE', $searchQuery); |
| 26 | 26 | } |
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - if($request->has('columnFilters')) { |
|
| 30 | + if ($request->has('columnFilters')) { |
|
| 31 | 31 | |
| 32 | 32 | $filters = get_object_vars(json_decode($request->columnFilters)); |
| 33 | 33 | |
| 34 | - foreach($filters as $key => $value) { |
|
| 35 | - if(!empty($value)) { |
|
| 34 | + foreach ($filters as $key => $value) { |
|
| 35 | + if (!empty($value)) { |
|
| 36 | 36 | $query->orWhere($key, 'like', '%' . $value . '%'); |
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - if($request->has('sort.0')) { |
|
| 41 | + if ($request->has('sort.0')) { |
|
| 42 | 42 | $sort = json_decode($request->sort[0]); |
| 43 | 43 | $query->orderBy($sort->field, $sort->type); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - if($request->has("perPage")) { |
|
| 46 | + if ($request->has("perPage")) { |
|
| 47 | 47 | $rows = $query->paginate($request->perPage); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | public function destroy($id) |
| 154 | 154 | { |
| 155 | 155 | $citation = Citation::find($id); |
| 156 | - if($citation) { |
|
| 156 | + if ($citation) { |
|
| 157 | 157 | $citation->delete(); |
| 158 | 158 | return "true"; |
| 159 | 159 | } |
@@ -16,37 +16,37 @@ discard block |
||
| 16 | 16 | { |
| 17 | 17 | $query = Person::query(); |
| 18 | 18 | |
| 19 | - if($request->has('searchTerm')) { |
|
| 20 | - $columnsToSearch = ['title','name','appellative','uid','email','phone','birthday','deathday','bank','bank_account','obs','givn','surn','type','npfx','nick','spfx','nsfx','secx','description','child_in_family_id','chan','rin','resn','rfn','afn']; |
|
| 19 | + if ($request->has('searchTerm')) { |
|
| 20 | + $columnsToSearch = ['title', 'name', 'appellative', 'uid', 'email', 'phone', 'birthday', 'deathday', 'bank', 'bank_account', 'obs', 'givn', 'surn', 'type', 'npfx', 'nick', 'spfx', 'nsfx', 'secx', 'description', 'child_in_family_id', 'chan', 'rin', 'resn', 'rfn', 'afn']; |
|
| 21 | 21 | $search_term = json_decode($request->searchTerm)->searchTerm; |
| 22 | - if(!empty($search_term)) { |
|
| 22 | + if (!empty($search_term)) { |
|
| 23 | 23 | $searchQuery = '%' . $search_term . '%'; |
| 24 | - foreach($columnsToSearch as $column) { |
|
| 24 | + foreach ($columnsToSearch as $column) { |
|
| 25 | 25 | $query->orWhere($column, 'LIKE', $searchQuery); |
| 26 | 26 | } |
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - if($request->has('columnFilters')) { |
|
| 30 | + if ($request->has('columnFilters')) { |
|
| 31 | 31 | |
| 32 | 32 | $filters = get_object_vars(json_decode($request->columnFilters)); |
| 33 | 33 | |
| 34 | - foreach($filters as $key => $value) { |
|
| 35 | - if(!empty($value)) { |
|
| 34 | + foreach ($filters as $key => $value) { |
|
| 35 | + if (!empty($value)) { |
|
| 36 | 36 | $query->orWhere($key, 'like', '%' . $value . '%'); |
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - if($request->has('sort.0')) { |
|
| 41 | + if ($request->has('sort.0')) { |
|
| 42 | 42 | $sort = json_decode($request->sort[0]); |
| 43 | 43 | $query->orderBy($sort->field, $sort->type); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - if($request->has("perPage")) { |
|
| 46 | + if ($request->has("perPage")) { |
|
| 47 | 47 | $rows = $query->paginate($request->perPage); |
| 48 | 48 | } |
| 49 | - if(!count($request->all())) { |
|
| 49 | + if (!count($request->all())) { |
|
| 50 | 50 | $rows = $query->get()->toArray(); |
| 51 | 51 | } |
| 52 | 52 | return $rows; |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | public function destroy($id) |
| 181 | 181 | { |
| 182 | 182 | $person = Person::find($id); |
| 183 | - if($person) { |
|
| 183 | + if ($person) { |
|
| 184 | 184 | $person->delete(); |
| 185 | 185 | return "true"; |
| 186 | 186 | } |
@@ -16,34 +16,34 @@ discard block |
||
| 16 | 16 | { |
| 17 | 17 | $query = PersonNameFone::query(); |
| 18 | 18 | |
| 19 | - if($request->has('searchTerm')) { |
|
| 19 | + if ($request->has('searchTerm')) { |
|
| 20 | 20 | $columnsToSearch = ['name', 'email', 'phone']; |
| 21 | 21 | $search_term = json_decode($request->searchTerm)->searchTerm; |
| 22 | - if(!empty($search_term)) { |
|
| 22 | + if (!empty($search_term)) { |
|
| 23 | 23 | $searchQuery = '%' . $search_term . '%'; |
| 24 | - foreach($columnsToSearch as $column) { |
|
| 24 | + foreach ($columnsToSearch as $column) { |
|
| 25 | 25 | $query->orWhere($column, 'LIKE', $searchQuery); |
| 26 | 26 | } |
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - if($request->has('columnFilters')) { |
|
| 30 | + if ($request->has('columnFilters')) { |
|
| 31 | 31 | |
| 32 | 32 | $filters = get_object_vars(json_decode($request->columnFilters)); |
| 33 | 33 | |
| 34 | - foreach($filters as $key => $value) { |
|
| 35 | - if(!empty($value)) { |
|
| 34 | + foreach ($filters as $key => $value) { |
|
| 35 | + if (!empty($value)) { |
|
| 36 | 36 | $query->orWhere($key, 'like', '%' . $value . '%'); |
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - if($request->has('sort.0')) { |
|
| 41 | + if ($request->has('sort.0')) { |
|
| 42 | 42 | $sort = json_decode($request->sort[0]); |
| 43 | 43 | $query->orderBy($sort->field, $sort->type); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - if($request->has("perPage")) { |
|
| 46 | + if ($request->has("perPage")) { |
|
| 47 | 47 | $rows = $query->paginate($request->perPage); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | public function destroy($id) |
| 163 | 163 | { |
| 164 | 164 | $personnamefonefone = PersonNameFone::find($id); |
| 165 | - if($personnamefonefone) { |
|
| 165 | + if ($personnamefonefone) { |
|
| 166 | 166 | $personnamefonefone->delete(); |
| 167 | 167 | return "true"; |
| 168 | 168 | } |
@@ -16,34 +16,34 @@ discard block |
||
| 16 | 16 | { |
| 17 | 17 | $query = Chan::query(); |
| 18 | 18 | |
| 19 | - if($request->has('searchTerm')) { |
|
| 20 | - $columnsToSearch = ['group','date','time']; |
|
| 19 | + if ($request->has('searchTerm')) { |
|
| 20 | + $columnsToSearch = ['group', 'date', 'time']; |
|
| 21 | 21 | $search_term = json_decode($request->searchTerm)->searchTerm; |
| 22 | - if(!empty($search_term)) { |
|
| 22 | + if (!empty($search_term)) { |
|
| 23 | 23 | $searchQuery = '%' . $search_term . '%'; |
| 24 | - foreach($columnsToSearch as $column) { |
|
| 24 | + foreach ($columnsToSearch as $column) { |
|
| 25 | 25 | $query->orWhere($column, 'LIKE', $searchQuery); |
| 26 | 26 | } |
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - if($request->has('columnFilters')) { |
|
| 30 | + if ($request->has('columnFilters')) { |
|
| 31 | 31 | |
| 32 | 32 | $filters = get_object_vars(json_decode($request->columnFilters)); |
| 33 | 33 | |
| 34 | - foreach($filters as $key => $value) { |
|
| 35 | - if(!empty($value)) { |
|
| 34 | + foreach ($filters as $key => $value) { |
|
| 35 | + if (!empty($value)) { |
|
| 36 | 36 | $query->orWhere($key, 'like', '%' . $value . '%'); |
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - if($request->has('sort.0')) { |
|
| 41 | + if ($request->has('sort.0')) { |
|
| 42 | 42 | $sort = json_decode($request->sort[0]); |
| 43 | 43 | $query->orderBy($sort->field, $sort->type); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - if($request->has("perPage")) { |
|
| 46 | + if ($request->has("perPage")) { |
|
| 47 | 47 | $rows = $query->paginate($request->perPage); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | public function destroy($id) |
| 132 | 132 | { |
| 133 | 133 | $chan = Chan::find($id); |
| 134 | - if($chan) { |
|
| 134 | + if ($chan) { |
|
| 135 | 135 | $chan->delete(); |
| 136 | 136 | return "true"; |
| 137 | 137 | } |
@@ -8,10 +8,10 @@ |
||
| 8 | 8 | class RoleController extends Controller |
| 9 | 9 | { |
| 10 | 10 | public function index() { |
| 11 | - return auth()->user()->getRoleNames(); |
|
| 11 | + return auth()->user()->getRoleNames(); |
|
| 12 | 12 | } |
| 13 | 13 | public function getRole(Request $request) { |
| 14 | - $query = Role::query(); |
|
| 14 | + $query = Role::query(); |
|
| 15 | 15 | |
| 16 | 16 | if($request->has('searchTerm')) { |
| 17 | 17 | $columnsToSearch = ['name']; |
@@ -13,34 +13,34 @@ discard block |
||
| 13 | 13 | public function getRole(Request $request) { |
| 14 | 14 | $query = Role::query(); |
| 15 | 15 | |
| 16 | - if($request->has('searchTerm')) { |
|
| 16 | + if ($request->has('searchTerm')) { |
|
| 17 | 17 | $columnsToSearch = ['name']; |
| 18 | 18 | $search_term = json_decode($request->searchTerm)->searchTerm; |
| 19 | - if(!empty($search_term)) { |
|
| 19 | + if (!empty($search_term)) { |
|
| 20 | 20 | $searchQuery = '%' . $search_term . '%'; |
| 21 | - foreach($columnsToSearch as $column) { |
|
| 21 | + foreach ($columnsToSearch as $column) { |
|
| 22 | 22 | $query->orWhere($column, 'LIKE', $searchQuery); |
| 23 | 23 | } |
| 24 | 24 | } |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - if($request->has('columnFilters')) { |
|
| 27 | + if ($request->has('columnFilters')) { |
|
| 28 | 28 | |
| 29 | 29 | $filters = get_object_vars(json_decode($request->columnFilters)); |
| 30 | 30 | |
| 31 | - foreach($filters as $key => $value) { |
|
| 32 | - if(!empty($value)) { |
|
| 31 | + foreach ($filters as $key => $value) { |
|
| 32 | + if (!empty($value)) { |
|
| 33 | 33 | $query->orWhere($key, 'like', '%' . $value . '%'); |
| 34 | 34 | } |
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - if($request->has('sort.0')) { |
|
| 38 | + if ($request->has('sort.0')) { |
|
| 39 | 39 | $sort = json_decode($request->sort[0]); |
| 40 | 40 | $query->orderBy($sort->field, $sort->type); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - if($request->has("perPage")) { |
|
| 43 | + if ($request->has("perPage")) { |
|
| 44 | 44 | $rows = $query->paginate($request->perPage); |
| 45 | 45 | } |
| 46 | 46 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | public function getRolePermission($id) { |
| 60 | 60 | $role = Role::find($id); |
| 61 | 61 | $permissions = $role->getAllPermissions()->pluck('id'); |
| 62 | - return ['role' => $role , 'permissions' => $permissions]; |
|
| 62 | + return ['role' => $role, 'permissions' => $permissions]; |
|
| 63 | 63 | } |
| 64 | 64 | public function update(Request $request, $id) |
| 65 | 65 | { |