Backend Pagebuilder Controller + Request Classes
linter / quality (push) Waiting to run
tests / ci (push) Waiting to run

This commit is contained in:
2025-05-05 15:30:43 +02:00
parent 60dc53b7ca
commit b1e031376f
7 changed files with 540 additions and 0 deletions
@@ -0,0 +1,39 @@
<?php
namespace App\Http\Requests\Backend\PageBuilder;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Auth;
class CreateRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool {
if (Auth::check())
return true;
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array {
if ($this->isMethod('get'))
return [];
return [
'title' => ['required', 'string', 'max:255'],
'content' => ['required', 'json'],
'publish' => ['required', 'boolean'],
'mainpage' => ['required', 'boolean'],
'linked' => ['required', 'boolean'],
'linkorder' => ['required', 'between:0,20'],
'visibility' => ['required', 'in:public,private'],
];
}
}
@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Backend\PageBuilder;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Auth;
class DeleteRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool {
if (Auth::check())
return true;
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array {
return [
//
];
}
}
@@ -0,0 +1,39 @@
<?php
namespace App\Http\Requests\Backend\PageBuilder;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Auth;
class EditRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool {
if (Auth::check())
return true;
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array {
if ($this->isMethod('get'))
return [];
return [
'title' => ['required', 'string', 'max:255'],
'content' => ['required', 'json'],
'publish' => ['required', 'boolean'],
'mainpage' => ['required', 'boolean'],
'linked' => ['required', 'boolean'],
'linkorder' => ['required', 'between:0,20'],
'visibility' => ['required', 'in:public,private'],
];
}
}
@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Backend\PageBuilder;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Auth;
class IndexRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool {
if (Auth::check())
return true;
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array {
return [
//
];
}
}
@@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests\Backend\PageBuilder;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Auth;
class PreviewRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool {
if (Auth::check())
return true;
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array {
return [
//
];
}
}
@@ -0,0 +1,31 @@
<?php
namespace App\Http\Requests\Backend\PageBuilder;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Auth;
class SetActiveRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool {
if (Auth::check())
return true;
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array {
return [
'title' => ['required', 'string', 'max:255'],
'content' => ['required', 'json']
];
}
}