HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux ip-172-26-0-120 6.17.0-1009-aws #9~24.04.2-Ubuntu SMP Fri Mar 6 23:50:29 UTC 2026 x86_64
User: ubuntu (1000)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: /var/www/html/dashboard.orbiwheels.com/app/Http/Requests/Admin/TransporterRequest.php
<?php

namespace App\Http\Requests\Admin;

use Illuminate\Foundation\Http\FormRequest;

class TransporterRequest 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
    {
        $rules = [
            'company_name' => 'required|string',
            'contact_person' => 'required|string',
            'first_name' => 'required|string',
            'last_name' => 'required|string',
            'email' => 'required|string|email',
            'phone' => 'required|digits:10',
            'address' => 'required|string|max:255',
            'transporter_type' => 'required|in:1,2',

            // 'doc_numbers.aadhaar' => 'required|string|max:30',
            // 'doc_numbers.pan' => 'required|string|max:30',
            // 'doc_numbers.gst' => 'required|string|max:30',
        ];

        if ($this->isMethod('post')) {
            $rules['password'] = 'required|string|confirmed|min:6';
            $rules['email'] .= '|unique:transporters,email';
            $rules['phone'] .= '|unique:transporters,phone';
            $rules['image'] = 'required|image|mimes:jpg,jpeg,png,webp|max:2048';

            // $rules['documents.aadhaar'] = 'required|file|mimes:pdf,jpg,jpeg,png|max:2048';
            //  $rules['documents.pan'] = 'required|file|mimes:pdf,jpg,jpeg,png|max:2048';
            //  $rules['documents.gst'] = 'required|file|mimes:pdf,jpg,jpeg,png|max:2048';
        } elseif ($this->isMethod('put')) {
            $userId = $this->route('id');
            $rules['password'] = 'nullable|string|confirmed|min:6';
            $rules['email'] .= '|unique:transporters,email,' . $userId;
            $rules['phone'] .= '|unique:transporters,phone,' . $userId;
            $rules['image'] = 'nullable|image|mimes:jpg,jpeg,png,webp|max:2048';

            //  $rules['documents.aadhaar'] = 'nullable|file|mimes:pdf,jpg,jpeg,png|max:2048';
            //  $rules['documents.pan'] = 'nullable|file|mimes:pdf,jpg,jpeg,png|max:2048';
            //  $rules['documents.gst'] = 'nullable|file|mimes:pdf,jpg,jpeg,png|max:2048';
        }

        return $rules;
    }
}