Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ludwigmair's avatar

Form Validation output Forbidden Problem

Hi,

i am trying to create a create Form using the new request validation. Unfortunately the output is only a blank site with forbidden. Any tip or idea how to fix this? i am logged in as a User

Controller:

    public function create()
    {
        return view("admin.invoice.create")->withTitle('Invoice Create');
    }

    /**
     * Store a newly created resource in storage.
     *
     * @return Response
     */
    public function store(InvoiceRequest $request)
    {
        dd('store');
    }

Requests/InvoiceRequest.php:

<?php namespace App\Http\Requests;

use App\Http\Requests\Request;

class InvoiceRequest extends Request {

    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return false;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'name'  => 'required'
        ];
    }

    /**
     * Get the sanitized input for the request.
     *
     * @return array
     */
    public function sanitize()
    {
        return $this->all();
    }


}

View:

{!! Form::open(['route' => 'invoice.store']) !!}

thanks Ludwig

0 likes
4 replies
bestmomo's avatar
Level 52
    public function authorize()
    {
        return true;
    }
16 likes

Please or to participate in this conversation.