create road item webservice

This commit is contained in:
2025-07-19 14:27:07 +03:30
parent 1aff61aece
commit de5dc2f686
7 changed files with 84 additions and 17 deletions

View File

@@ -1,29 +1,27 @@
<?php
namespace App\Http\Requests\V3\RoadItem\WebService;
namespace App\Http\Requests\V3\WebServices\RoadItem;
use App\Models\User;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
class CheckRequest extends FormRequest
class IndexRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
$user = Auth::user();
return (
$user->username === 'service_user257'&&
Hash::check('S3rv1ce@123', $user->password) );
return
$this->username === 'service_user257' &&
Hash::check('S3rv1ce@123', $this->password);
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
* @return array<string, ValidationRule|array|string>
*/
public function rules(): array
{

View File

@@ -0,0 +1,34 @@
<?php
namespace App\Http\Requests\V3\WebServices\RoadMaintenanceStation;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Hash;
class IndexRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return
$this->username === 'service_user257' &&
Hash::check('S3rv1ce@123', $this->password);
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, ValidationRule|array|string>
*/
public function rules(): array
{
return [
'province' => 'exists:provinces,id',
'status' => 'in:0,1',
'type' => 'in:1,2,3',
];
}
}