urameshibr / lumen-form-request

Laravel Form Request adaptation for Lumen framework
3 stars 1 forks source link

Call to a member function parameter() on array #8

Open mohammadgh1370 opened 3 years ago

mohammadgh1370 commented 3 years ago

hi, thank you for this package

this error occured for me

Call to a member function parameter() on array

get id from route same below:


return[
'name'          => 'unique:roles,name,' . $this->route('id'),
];

but $this->route() return array
mohammadgh1370 commented 3 years ago

hi

use this function overwrite to class

public function route($param = null, $default = null)
    {
        $route = ($this->getRouteResolver())();

        if (is_null($route) || is_null($param)) {
            return $route;
        }

        return Arr::get($route[2], $param, $default);
    }