HttpException in Handler.php line 133: This action is unauthorized HttpException in Handler.php line 133: This action is unauthorized laravel laravel

HttpException in Handler.php line 133: This action is unauthorized


Check that your AnnouncementRequest file is set to return true from authorize function. The default is to return false.


If you can use CustomRequest method for validation then make sure to your authorize() return true. If you can set false then its never call your function as well throw the error This action is unauthorized

Solution

class CopyRequest extends FormRequest{    /**     * Determine if the user is authorized to make this request.     *     * @return bool     */    public function authorize()    {         return true;   //Default false .Now set return true;    }}


Default function return false so change it as shown below

public function authorize()    {        return true;    }

or also can use Auth in the Request

use Illuminate\Support\Facades\Auth; public function authorize()    {        return Auth::check();    }