Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as PHP by Prezi ( 6 years ago )
public function rules()
    {
        $rules =  [
            'user_id' => 'required|exists:users,id|unique:couriers,user_id', 
        ];

        if (in_array($this->method(), ['PUT', 'PATCH'])) {
            $id = $this->route()->parameter('delivery');

            $rules['user_id'] = [
                'required',
                'exists:users,id',
                IlluminateValidationRule::unique('couriers','user_id')->ignore($id),
            ];
        }

        return $rules;
    }

 

Revise this Paste

Children: 112438
Your Name: Code Language: