Merge branch 'feature/damage_crud' into 'develop'

create controller ,request and route about damage and fix model

See merge request witelgroup/rms_v2!69
This commit is contained in:
AmirHossein Mahmoodi
2025-02-17 10:37:57 +00:00
9 changed files with 254 additions and 5 deletions

View File

@@ -0,0 +1,28 @@
<?php
namespace App\Http\Requests\V3\Damage;
use Illuminate\Foundation\Http\FormRequest;
class DeleteRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'status' => 'required|in:0,1',
];
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Http\Requests\V3\Damage;
use Illuminate\Foundation\Http\FormRequest;
class StoreRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* 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|unique:damages,title',
'unit' =>'required|string|max:255',
'base_price' =>'required|integer',
'status' =>'required|in:0,1',
];
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Http\Requests\V3\Damage;
use Illuminate\Foundation\Http\FormRequest;
class UpdateRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* 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|unique:damages,title',
'unit' =>'required|string',
'base_price' =>'required|numeric',
'status' =>'required|integer',
];
}
}