- Menambahkan model CustomField dengan atribut mass assignable. - Membuat request validation untuk custom field. - Menambahkan route dan breadcrumb untuk custom field. - Membuat migration untuk tabel custom_fields. - Menambahkan export functionality untuk custom field. - Membuat view untuk menambah dan mengedit custom field.
34 lines
687 B
PHP
34 lines
687 B
PHP
<?php
|
|
|
|
namespace Modules\Lpj\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class CustomFieldRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'name' => 'required|max:255',
|
|
'type' => 'required|in:text,select,radio,checkbox',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function prepareValidationData($data){
|
|
if(!$this->type){
|
|
$this->merge(['type' => 'text']);
|
|
}
|
|
}
|
|
}
|