- Introduced CustomerController for handling customer operations. - Added resourceful routes for customers in the web routes. - Updated DatabaseSeeder to include CustomerSeeder for initial data population. - Modified sidebar navigation to link to the customers index.
35 lines
807 B
PHP
35 lines
807 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Admin\Master;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class CustomerRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
$customer = $this->route('customer');
|
|
|
|
return [
|
|
'name' => ['required', 'string', 'max:200', Rule::unique('customers', 'name')->ignore($customer)],
|
|
'phone_number' => ['nullable', 'string', 'max:20', 'digits_between:1,20'],
|
|
'address' => ['nullable', 'string'],
|
|
];
|
|
}
|
|
|
|
public function attributes(): array
|
|
{
|
|
return [
|
|
'name' => 'nama',
|
|
'phone_number' => 'nomor telepon',
|
|
'address' => 'alamat',
|
|
];
|
|
}
|
|
}
|