first
This commit is contained in:
39
app/Http/Requests/Admin/Setup/ImportPusatRequest.php
Normal file
39
app/Http/Requests/Admin/Setup/ImportPusatRequest.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Admin\Setup;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ImportPusatRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->user()?->hasRole('Admin') === true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'election_id' => ['required', 'integer', 'exists:elections,id'],
|
||||
'dun_code' => ['required', 'string', 'max:20'],
|
||||
'dun_name' => ['required', 'string', 'max:255'],
|
||||
'file' => ['required', 'file', 'mimes:xlsx', 'max:10240'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function attributes(): array
|
||||
{
|
||||
return [
|
||||
'election_id' => 'pilihan raya',
|
||||
'dun_code' => 'kod DUN',
|
||||
'dun_name' => 'nama DUN',
|
||||
'file' => 'fail XLSX',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user