| Server IP : 13.235.167.51 / Your IP : 216.73.217.116 Web Server : Apache System : Linux machinox-server 6.17.0-1013-aws #13~24.04.1-Ubuntu SMP Fri Apr 24 21:36:58 UTC 2026 aarch64 User : root ( 0) PHP Version : 8.2.29 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/app.machinox.in/app/Http/Requests/WebService/ |
Upload File : |
<?php
namespace App\Http\Requests\WebService;
use Illuminate\Foundation\Http\FormRequest;
class AdvertiseRequest 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 [
'advertise_type' => 'required|in:RENT,SELL',
'title' => 'required|string|max:255',
'description' => 'nullable|string',
'machine_type_id' => 'required|exists:machine_types,id',
'machine_model_id' => 'required|exists:machine_models,id',
'year_manufactured' => 'nullable|digits:4|integer|min:1900|max:' . date('Y'),
'price' => 'nullable|numeric|min:0',
'running_hours' => 'nullable|min:0',
'condition' => 'nullable|string|max:255',
'location' => 'nullable|string|max:255',
'state' => 'nullable|string|max:255',
'latitude' => 'nullable|numeric|between:-90,90',
'longitude' => 'nullable|numeric|between:-180,180',
'images.*' => 'nullable|image|mimes:jpeg,png,jpg,gif|max:5120',
];
}
public function attributes()
{
return [
'advertise_type' => trans('messages.ADVERTISE_TYPE'),
'title' => trans('messages.TITLE'),
'description' => trans('messages.DESCRIPTION'),
'machine_type_id' => trans('messages.MACHINE_TYPE_ID'),
'machine_model_id' => trans('messages.MACHINE_MODEL_ID'),
'year_manufactured' => trans('messages.YEAR_MANUFACTURED'),
'price' => trans('messages.PRICE'),
'running_hours' => trans('messages.RUNNING_HOURS'),
'condition' => trans('messages.CONDITION'),
'location' => trans('messages.LOCATION'),
'latitude' => trans('messages.LATITUDE'),
'longitude' => trans('messages.LONGITUDE'),
'images.*' => trans('messages.IMAGES'),
];
}
public function messages()
{
return [
'advertise_type.required' => trans('messages.ADVERTISE_TYPE_REQUIRED'),
'advertise_type.in' => trans('messages.ADVERTISE_TYPE_INVALID'),
'title.required' => trans('messages.TITLE_REQUIRED'),
'title.string' => trans('messages.TITLE_STRING'),
'title.max' => trans('messages.TITLE_MAX'),
'description.string' => trans('messages.DESCRIPTION_STRING'),
'machine_type_id.required' => trans('messages.MACHINE_TYPE_ID_REQUIRED'),
'machine_type_id.exists' => trans('messages.MACHINE_TYPE_ID_EXISTS'),
'machine_model_id.required' => trans('messages.MACHINE_MODEL_ID_REQUIRED'),
'machine_model_id.exists' => trans('messages.MACHINE_MODEL_ID_EXISTS'),
'year_manufactured.digits' => trans('messages.YEAR_MANUFACTURED_DIGITS'),
'year_manufactured.integer' => trans('messages.YEAR_MANUFACTURED_INTEGER'),
'year_manufactured.min' => trans('messages.YEAR_MANUFACTURED_MIN'),
'year_manufactured.max' => trans('messages.YEAR_MANUFACTURED_MAX'),
'price.numeric' => trans('messages.PRICE_NUMERIC'),
'price.min' => trans('messages.PRICE_MIN'),
'running_hours.integer' => trans('messages.RUNNING_HOURS_INTEGER'),
'running_hours.min' => trans('messages.RUNNING_HOURS_MIN'),
'condition.string' => trans('messages.CONDITION_STRING'),
'location.string' => trans('messages.LOCATION_STRING'),
'latitude.numeric' => trans('messages.LATITUDE_NUMERIC'),
'latitude.between' => trans('messages.LATITUDE_BETWEEN'),
'longitude.numeric' => trans('messages.LONGITUDE_NUMERIC'),
'longitude.between' => trans('messages.LONGITUDE_BETWEEN'),
'images.*.image' => trans('messages.IMAGE_TYPE'),
'images.*.mimes' => trans('messages.IMAGE_MIMES'),
'images.*.max' => trans('messages.IMAGE_MAX'),
];
}
}