- Added SupplierController for handling supplier operations. - Created SupplierRequest for validation of supplier data. - Introduced SupplierService for business logic related to suppliers. - Developed UI components for supplier management, including a data table and dialogs for creating and editing suppliers. - Updated routes to include resourceful routes for suppliers. - Added SupplierSeeder for populating initial supplier data. - Implemented tests for supplier functionality, including creation, updating, and deletion.
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 SupplierRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
$supplier = $this->route('supplier');
|
|
|
|
return [
|
|
'name' => ['required', 'string', 'max:200', Rule::unique('suppliers', 'name')->ignore($supplier)],
|
|
'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',
|
|
];
|
|
}
|
|
}
|