diff --git a/app/Http/Controllers/Frontend/SitelinkController.php b/app/Http/Controllers/Frontend/SitelinkController.php index 81506fb..10ed718 100644 --- a/app/Http/Controllers/Frontend/SitelinkController.php +++ b/app/Http/Controllers/Frontend/SitelinkController.php @@ -53,7 +53,7 @@ class SitelinkController extends Controller ->whereYear('server_date_published', '>=', $from) ->whereYear('server_date_published', '<', $until); - $documents = $select->orderBy('publish_id', 'asc') + $documents = $select->orderBy('publish_id') ->get(); //$this->years = Dataset::select(DB::raw('YEAR(server_date_modified) as server_date_modified')) diff --git a/app/Http/Controllers/Publish/DoiController.php b/app/Http/Controllers/Publish/DoiController.php index a24f350..f323f17 100644 --- a/app/Http/Controllers/Publish/DoiController.php +++ b/app/Http/Controllers/Publish/DoiController.php @@ -64,7 +64,7 @@ class DoiController extends Controller { $datasets = Dataset::query() ->has('identifier') - ->orderBy('server_date_modified', 'desc') + ->orderByDesc('server_date_modified') ->get(); return View::make('workflow.doi.index', [ 'datasets' => $datasets, diff --git a/app/Http/Controllers/Publish/EditorController.php b/app/Http/Controllers/Publish/EditorController.php index 22a1976..9991c77 100644 --- a/app/Http/Controllers/Publish/EditorController.php +++ b/app/Http/Controllers/Publish/EditorController.php @@ -87,7 +87,7 @@ class EditorController extends Controller $query->whereIn('server_state', ['editor_accepted', 'rejected_reviewer', 'reviewed', 'published']) ->where('editor_id', $user_id)->doesntHave('identifier', 'and'); }) - ->orderBy('server_date_modified', 'desc') + ->orderByDesc('server_date_modified') ->get(); // return View::make('workflow.editor.index', compact('datasets')); return View::make('workflow.editor.index', [ diff --git a/app/Http/Controllers/Publish/SubmitController.php b/app/Http/Controllers/Publish/SubmitController.php index 040feef..3f5e014 100644 --- a/app/Http/Controllers/Publish/SubmitController.php +++ b/app/Http/Controllers/Publish/SubmitController.php @@ -47,7 +47,7 @@ class SubmitController extends Controller 'released', 'editor_accepted', 'approved', 'reviewed', 'rejected_editor', 'rejected_reviewer']) ->where('account_id', $user_id) ->with('user:id,login') - ->orderBy('server_date_modified', 'desc') + ->orderByDesc('server_date_modified') ->get(); return View::make('workflow.submitter.index', [ 'datasets' => $myDatasets, diff --git a/app/Http/Controllers/Settings/Access/UserController.php b/app/Http/Controllers/Settings/Access/UserController.php index 5d16b53..c568688 100644 --- a/app/Http/Controllers/Settings/Access/UserController.php +++ b/app/Http/Controllers/Settings/Access/UserController.php @@ -30,7 +30,7 @@ class UserController extends Controller //} $users = User::with('roles') - ->orderBy('id', 'DESC') + ->orderByDesc('id') ->paginate(5); return view('settings.access.user.user', compact('users')) ->with('i', ($request->input('page', 1) - 1) * 5); diff --git a/app/Http/Requests/Collection/CollectionRequest.php b/app/Http/Requests/Collection/CollectionRequest.php index db233d2..0794d61 100644 --- a/app/Http/Requests/Collection/CollectionRequest.php +++ b/app/Http/Requests/Collection/CollectionRequest.php @@ -27,8 +27,13 @@ class CollectionRequest extends Request public function rules() { return [ - 'name' => 'required|max:255', - 'role_id' => 'required', + 'name' => [ + 'required', + 'max:255', + ], + 'role_id' => [ + 'required', + ], ]; } } diff --git a/app/Http/Requests/DocumentRequest.php b/app/Http/Requests/DocumentRequest.php index 0ad0e59..7c2c6f6 100644 --- a/app/Http/Requests/DocumentRequest.php +++ b/app/Http/Requests/DocumentRequest.php @@ -24,8 +24,13 @@ class DocumentRequest extends Request public function rules() { return [ - 'type' => 'required|min:3', - 'server_state' => 'required', + 'type' => [ + 'required', + 'min:3', + ], + 'server_state' => [ + 'required', + ], // 'author' => 'required|min:4', // 'stock' => 'required|integer', // 'year' => 'required|integer|min:4' diff --git a/app/Http/Requests/LicenseRequest.php b/app/Http/Requests/LicenseRequest.php index 6b8a675..823e357 100644 --- a/app/Http/Requests/LicenseRequest.php +++ b/app/Http/Requests/LicenseRequest.php @@ -24,15 +24,40 @@ class LicenseRequest extends Request public function rules() { return [ - 'desc_text' => 'max:4000', - 'language' => 'max:3', - 'link_licence' => 'required|url:max:255', - 'link_logo' => 'url|max:255', - 'mime_type' => 'max:30', - 'name_long' => 'required|min:5|max:255', - 'sort_order' => 'required|integer', - 'active' => 'required|boolean', - 'pod_allowed' => 'required|boolean' + 'desc_text' => [ + 'max:4000', + ], + 'language' => [ + 'max:3', + ], + 'link_licence' => [ + 'required', + 'url:max:255', + ], + 'link_logo' => [ + 'url', + 'max:255', + ], + 'mime_type' => [ + 'max:30', + ], + 'name_long' => [ + 'required', + 'min:5', + 'max:255', + ], + 'sort_order' => [ + 'required', + 'integer', + ], + 'active' => [ + 'required', + 'boolean', + ], + 'pod_allowed' => [ + 'required', + 'boolean', + ], ]; } } diff --git a/app/Http/Requests/Pages/UpdatePageRequest.php b/app/Http/Requests/Pages/UpdatePageRequest.php index 81e5e58..128e16e 100644 --- a/app/Http/Requests/Pages/UpdatePageRequest.php +++ b/app/Http/Requests/Pages/UpdatePageRequest.php @@ -28,7 +28,10 @@ class UpdatePageRequest extends Request public function rules() { return [ - 'en_title' => 'required|max:191' + 'en_title' => [ + 'required', + 'max:191', + ], // 'description_en' => 'required' ]; } diff --git a/app/Http/Requests/PeminjamanRequest.php b/app/Http/Requests/PeminjamanRequest.php deleted file mode 100755 index a108f7c..0000000 --- a/app/Http/Requests/PeminjamanRequest.php +++ /dev/null @@ -1,30 +0,0 @@ - 'required|integer' - ]; - } -} diff --git a/app/Http/Requests/Person/CreatePersonRequest.php b/app/Http/Requests/Person/CreatePersonRequest.php index f4a71f3..8fe2821 100644 --- a/app/Http/Requests/Person/CreatePersonRequest.php +++ b/app/Http/Requests/Person/CreatePersonRequest.php @@ -24,17 +24,45 @@ class CreatePersonRequest extends Request public function rules() { return [ - 'academic_title' => 'nullable|min:2|max:255', - 'last_name' => 'required|min:3|max:255|unique_with:persons,first_name,date_of_birth', - 'first_name' => 'required|min:3|max:255', - 'email' => 'required|email|max:50|unique:persons,email', + 'academic_title' => [ + 'nullable', + 'min:2', + 'max:255', + ], + 'last_name' => [ + 'required', + 'min:3', + 'max:255', + 'unique_with:persons,first_name,date_of_birth', + ], + 'first_name' => [ + 'required', + 'min:3', + 'max:255', + ], + 'email' => [ + 'required', + 'email', + 'max:50', + 'unique:persons,email', + ], // 'email' => [ // 'required', 'email', 'max:100', // Rule::unique('persons')->ignore($user->id), // ], - 'identifier_orcid' => 'nullable|min:19|max:50', - 'status' => 'required|boolean', - 'date_of_birth' => 'nullable|date' + 'identifier_orcid' => [ + 'nullable', + 'min:19', + 'max:50', + ], + 'status' => [ + 'required', + 'boolean', + ], + 'date_of_birth' => [ + 'nullable', + 'date', + ], ]; } } diff --git a/app/Http/Requests/Person/EditPersonRequest.php b/app/Http/Requests/Person/EditPersonRequest.php index d003693..44eb0bf 100644 --- a/app/Http/Requests/Person/EditPersonRequest.php +++ b/app/Http/Requests/Person/EditPersonRequest.php @@ -26,17 +26,45 @@ class EditPersonRequest extends Request public function rules() { return [ - 'academic_title' => 'nullable|min:2|max:255', - 'last_name' => 'required|min:3|max:255|unique_with:persons,first_name,date_of_birth', - 'first_name' => 'required|min:3|max:255', - 'email' => 'required|email|max:50|unique:persons,email', + 'academic_title' => [ + 'nullable', + 'min:2', + 'max:255', + ], + 'last_name' => [ + 'required', + 'min:3', + 'max:255', + 'unique_with:persons,first_name,date_of_birth', + ], + 'first_name' => [ + 'required', + 'min:3', + 'max:255', + ], + 'email' => [ + 'required', + 'email', + 'max:50', + 'unique:persons,email', + ], // 'email' => [ // 'required', 'email', 'max:100', // Rule::unique('persons')->ignore($user->id), // ], - 'identifier_orcid' => 'nullable|min:19|max:50', - 'status' => 'required|boolean', - 'date_of_birth' => 'nullable|date' + 'identifier_orcid' => [ + 'nullable', + 'min:19', + 'max:50', + ], + 'status' => [ + 'required', + 'boolean', + ], + 'date_of_birth' => [ + 'nullable', + 'date', + ], ]; } } diff --git a/app/Http/Requests/ProjectRequest.php b/app/Http/Requests/ProjectRequest.php index bf48563..0fd103c 100644 --- a/app/Http/Requests/ProjectRequest.php +++ b/app/Http/Requests/ProjectRequest.php @@ -24,9 +24,19 @@ class ProjectRequest extends Request { return [ - 'name' => 'required|min:3|max:255', - 'label' => 'required|min:3|max:20', - 'description' => 'required' + 'name' => [ + 'required', + 'min:3', + 'max:255', + ], + 'label' => [ + 'required', + 'min:3', + 'max:20', + ], + 'description' => [ + 'required', + ], ]; } } diff --git a/app/Http/Requests/ShelfRequest.php b/app/Http/Requests/ShelfRequest.php deleted file mode 100755 index 59e2d1c..0000000 --- a/app/Http/Requests/ShelfRequest.php +++ /dev/null @@ -1,30 +0,0 @@ - 'required' - ]; - } -} diff --git a/app/Models/Dataset.php b/app/Models/Dataset.php index 6faa56e..7926acf 100644 --- a/app/Models/Dataset.php +++ b/app/Models/Dataset.php @@ -301,7 +301,7 @@ class Dataset extends Model $result = Dataset::select('server_date_published') ->where('server_date_published', '<>', null) ->where('server_state', 'published') - ->orderBy('server_date_published', 'asc') + ->orderBy('server_date_published') ->first(); //->server_date_published; return $result; diff --git a/database/factories/ModelFactory.php b/database/factories/ModelFactory.php new file mode 100644 index 0000000..e69de29 diff --git a/routes/api.php b/routes/api.php index 674fdcb..00e7254 100644 --- a/routes/api.php +++ b/routes/api.php @@ -70,7 +70,7 @@ $appRoutes = function () { ->whereYear('server_date_published', '>=', $from) ->whereYear('server_date_published', '<', $until); - $documents = $select->orderBy('publish_id', 'asc') + $documents = $select->orderBy('publish_id') ->get(); return response() ->json($documents) @@ -118,7 +118,7 @@ $appRoutes = function () { $query = $query->orderBy($sortCol, $sortDir); } } else { - $query = $query->orderBy('id', 'asc'); + $query = $query->orderBy('id'); } //handle filter