- Form Request array syntax: Convert pipe (|) delimited validation rules from strings into an array of validation rules while using Laravel Rule objects where available
- Streamline order methods: Streamline query builder orderBy calls with asc and desc arguments. - delete some old Request-Clases
This commit is contained in:
parent
6156bdf0c6
commit
50ceeb193b
|
@ -53,7 +53,7 @@ class SitelinkController extends Controller
|
||||||
->whereYear('server_date_published', '>=', $from)
|
->whereYear('server_date_published', '>=', $from)
|
||||||
->whereYear('server_date_published', '<', $until);
|
->whereYear('server_date_published', '<', $until);
|
||||||
|
|
||||||
$documents = $select->orderBy('publish_id', 'asc')
|
$documents = $select->orderBy('publish_id')
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
//$this->years = Dataset::select(DB::raw('YEAR(server_date_modified) as server_date_modified'))
|
//$this->years = Dataset::select(DB::raw('YEAR(server_date_modified) as server_date_modified'))
|
||||||
|
|
|
@ -64,7 +64,7 @@ class DoiController extends Controller
|
||||||
{
|
{
|
||||||
$datasets = Dataset::query()
|
$datasets = Dataset::query()
|
||||||
->has('identifier')
|
->has('identifier')
|
||||||
->orderBy('server_date_modified', 'desc')
|
->orderByDesc('server_date_modified')
|
||||||
->get();
|
->get();
|
||||||
return View::make('workflow.doi.index', [
|
return View::make('workflow.doi.index', [
|
||||||
'datasets' => $datasets,
|
'datasets' => $datasets,
|
||||||
|
|
|
@ -87,7 +87,7 @@ class EditorController extends Controller
|
||||||
$query->whereIn('server_state', ['editor_accepted', 'rejected_reviewer', 'reviewed', 'published'])
|
$query->whereIn('server_state', ['editor_accepted', 'rejected_reviewer', 'reviewed', 'published'])
|
||||||
->where('editor_id', $user_id)->doesntHave('identifier', 'and');
|
->where('editor_id', $user_id)->doesntHave('identifier', 'and');
|
||||||
})
|
})
|
||||||
->orderBy('server_date_modified', 'desc')
|
->orderByDesc('server_date_modified')
|
||||||
->get();
|
->get();
|
||||||
// return View::make('workflow.editor.index', compact('datasets'));
|
// return View::make('workflow.editor.index', compact('datasets'));
|
||||||
return View::make('workflow.editor.index', [
|
return View::make('workflow.editor.index', [
|
||||||
|
|
|
@ -47,7 +47,7 @@ class SubmitController extends Controller
|
||||||
'released', 'editor_accepted', 'approved', 'reviewed', 'rejected_editor', 'rejected_reviewer'])
|
'released', 'editor_accepted', 'approved', 'reviewed', 'rejected_editor', 'rejected_reviewer'])
|
||||||
->where('account_id', $user_id)
|
->where('account_id', $user_id)
|
||||||
->with('user:id,login')
|
->with('user:id,login')
|
||||||
->orderBy('server_date_modified', 'desc')
|
->orderByDesc('server_date_modified')
|
||||||
->get();
|
->get();
|
||||||
return View::make('workflow.submitter.index', [
|
return View::make('workflow.submitter.index', [
|
||||||
'datasets' => $myDatasets,
|
'datasets' => $myDatasets,
|
||||||
|
|
|
@ -30,7 +30,7 @@ class UserController extends Controller
|
||||||
//}
|
//}
|
||||||
|
|
||||||
$users = User::with('roles')
|
$users = User::with('roles')
|
||||||
->orderBy('id', 'DESC')
|
->orderByDesc('id')
|
||||||
->paginate(5);
|
->paginate(5);
|
||||||
return view('settings.access.user.user', compact('users'))
|
return view('settings.access.user.user', compact('users'))
|
||||||
->with('i', ($request->input('page', 1) - 1) * 5);
|
->with('i', ($request->input('page', 1) - 1) * 5);
|
||||||
|
|
|
@ -27,8 +27,13 @@ class CollectionRequest extends Request
|
||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'name' => 'required|max:255',
|
'name' => [
|
||||||
'role_id' => 'required',
|
'required',
|
||||||
|
'max:255',
|
||||||
|
],
|
||||||
|
'role_id' => [
|
||||||
|
'required',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,8 +24,13 @@ class DocumentRequest extends Request
|
||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'type' => 'required|min:3',
|
'type' => [
|
||||||
'server_state' => 'required',
|
'required',
|
||||||
|
'min:3',
|
||||||
|
],
|
||||||
|
'server_state' => [
|
||||||
|
'required',
|
||||||
|
],
|
||||||
// 'author' => 'required|min:4',
|
// 'author' => 'required|min:4',
|
||||||
// 'stock' => 'required|integer',
|
// 'stock' => 'required|integer',
|
||||||
// 'year' => 'required|integer|min:4'
|
// 'year' => 'required|integer|min:4'
|
||||||
|
|
|
@ -24,15 +24,40 @@ class LicenseRequest extends Request
|
||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'desc_text' => 'max:4000',
|
'desc_text' => [
|
||||||
'language' => 'max:3',
|
'max:4000',
|
||||||
'link_licence' => 'required|url:max:255',
|
],
|
||||||
'link_logo' => 'url|max:255',
|
'language' => [
|
||||||
'mime_type' => 'max:30',
|
'max:3',
|
||||||
'name_long' => 'required|min:5|max:255',
|
],
|
||||||
'sort_order' => 'required|integer',
|
'link_licence' => [
|
||||||
'active' => 'required|boolean',
|
'required',
|
||||||
'pod_allowed' => 'required|boolean'
|
'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',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,10 @@ class UpdatePageRequest extends Request
|
||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'en_title' => 'required|max:191'
|
'en_title' => [
|
||||||
|
'required',
|
||||||
|
'max:191',
|
||||||
|
],
|
||||||
// 'description_en' => 'required'
|
// 'description_en' => 'required'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
<?php
|
|
||||||
namespace App\Http\Requests;
|
|
||||||
|
|
||||||
use App\Http\Requests\Request;
|
|
||||||
|
|
||||||
class PeminjamanRequest extends Request
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine if the user is authorized to make this request.
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function authorize()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the validation rules that apply to the request.
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function rules()
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
//
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,29 +0,0 @@
|
||||||
<?php
|
|
||||||
namespace App\Http\Requests;
|
|
||||||
|
|
||||||
use App\Http\Requests\Request;
|
|
||||||
|
|
||||||
class PeriodeRequest extends Request
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Determine if the user is authorized to make this request.
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function authorize()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the validation rules that apply to the request.
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function rules()
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'days' => 'required|integer'
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -24,17 +24,45 @@ class CreatePersonRequest extends Request
|
||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'academic_title' => 'nullable|min:2|max:255',
|
'academic_title' => [
|
||||||
'last_name' => 'required|min:3|max:255|unique_with:persons,first_name,date_of_birth',
|
'nullable',
|
||||||
'first_name' => 'required|min:3|max:255',
|
'min:2',
|
||||||
'email' => 'required|email|max:50|unique:persons,email',
|
'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' => [
|
// 'email' => [
|
||||||
// 'required', 'email', 'max:100',
|
// 'required', 'email', 'max:100',
|
||||||
// Rule::unique('persons')->ignore($user->id),
|
// Rule::unique('persons')->ignore($user->id),
|
||||||
// ],
|
// ],
|
||||||
'identifier_orcid' => 'nullable|min:19|max:50',
|
'identifier_orcid' => [
|
||||||
'status' => 'required|boolean',
|
'nullable',
|
||||||
'date_of_birth' => 'nullable|date'
|
'min:19',
|
||||||
|
'max:50',
|
||||||
|
],
|
||||||
|
'status' => [
|
||||||
|
'required',
|
||||||
|
'boolean',
|
||||||
|
],
|
||||||
|
'date_of_birth' => [
|
||||||
|
'nullable',
|
||||||
|
'date',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,17 +26,45 @@ class EditPersonRequest extends Request
|
||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'academic_title' => 'nullable|min:2|max:255',
|
'academic_title' => [
|
||||||
'last_name' => 'required|min:3|max:255|unique_with:persons,first_name,date_of_birth',
|
'nullable',
|
||||||
'first_name' => 'required|min:3|max:255',
|
'min:2',
|
||||||
'email' => 'required|email|max:50|unique:persons,email',
|
'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' => [
|
// 'email' => [
|
||||||
// 'required', 'email', 'max:100',
|
// 'required', 'email', 'max:100',
|
||||||
// Rule::unique('persons')->ignore($user->id),
|
// Rule::unique('persons')->ignore($user->id),
|
||||||
// ],
|
// ],
|
||||||
'identifier_orcid' => 'nullable|min:19|max:50',
|
'identifier_orcid' => [
|
||||||
'status' => 'required|boolean',
|
'nullable',
|
||||||
'date_of_birth' => 'nullable|date'
|
'min:19',
|
||||||
|
'max:50',
|
||||||
|
],
|
||||||
|
'status' => [
|
||||||
|
'required',
|
||||||
|
'boolean',
|
||||||
|
],
|
||||||
|
'date_of_birth' => [
|
||||||
|
'nullable',
|
||||||
|
'date',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,9 +24,19 @@ class ProjectRequest extends Request
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
|
||||||
'name' => 'required|min:3|max:255',
|
'name' => [
|
||||||
'label' => 'required|min:3|max:20',
|
'required',
|
||||||
'description' => 'required'
|
'min:3',
|
||||||
|
'max:255',
|
||||||
|
],
|
||||||
|
'label' => [
|
||||||
|
'required',
|
||||||
|
'min:3',
|
||||||
|
'max:20',
|
||||||
|
],
|
||||||
|
'description' => [
|
||||||
|
'required',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
<?php
|
|
||||||
namespace App\Http\Requests;
|
|
||||||
|
|
||||||
use App\Http\Requests\Request;
|
|
||||||
|
|
||||||
class ShelfRequest extends Request
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine if the user is authorized to make this request.
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function authorize()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the validation rules that apply to the request.
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function rules()
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'shelf' => 'required'
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -301,7 +301,7 @@ class Dataset extends Model
|
||||||
$result = Dataset::select('server_date_published')
|
$result = Dataset::select('server_date_published')
|
||||||
->where('server_date_published', '<>', null)
|
->where('server_date_published', '<>', null)
|
||||||
->where('server_state', 'published')
|
->where('server_state', 'published')
|
||||||
->orderBy('server_date_published', 'asc')
|
->orderBy('server_date_published')
|
||||||
->first();
|
->first();
|
||||||
//->server_date_published;
|
//->server_date_published;
|
||||||
return $result;
|
return $result;
|
||||||
|
|
0
database/factories/ModelFactory.php
Normal file
0
database/factories/ModelFactory.php
Normal file
|
@ -70,7 +70,7 @@ $appRoutes = function () {
|
||||||
->whereYear('server_date_published', '>=', $from)
|
->whereYear('server_date_published', '>=', $from)
|
||||||
->whereYear('server_date_published', '<', $until);
|
->whereYear('server_date_published', '<', $until);
|
||||||
|
|
||||||
$documents = $select->orderBy('publish_id', 'asc')
|
$documents = $select->orderBy('publish_id')
|
||||||
->get();
|
->get();
|
||||||
return response()
|
return response()
|
||||||
->json($documents)
|
->json($documents)
|
||||||
|
@ -118,7 +118,7 @@ $appRoutes = function () {
|
||||||
$query = $query->orderBy($sortCol, $sortDir);
|
$query = $query->orderBy($sortCol, $sortDir);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$query = $query->orderBy('id', 'asc');
|
$query = $query->orderBy('id');
|
||||||
}
|
}
|
||||||
|
|
||||||
//handle filter
|
//handle filter
|
||||||
|
|
Loading…
Reference in New Issue
Block a user