We help IT Professionals succeed at work.
Get Started

What Are "Requests" in Laravel?

Bruce Gust
Bruce Gust asked
Last Modified: 2020-01-03
I'm working through a Laravel tutorial and it references "Requests." I followed along and I created a "CreatePage.php" file in a brand new "Requests" folder and it looks like this:


namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class CreatePage extends FormRequest
     * Determine if the user is authorized to make this request.
     * @return bool
    public function authorize()
        return true;

     * Get the validation rules that apply to the request.
     * @return array
    public function rules()
        return [
            'name' => 'required', 
			'body' => 'required'

Open in new window

Does this need to be cited in a Controller or a Model? I ask because the "rules" seem to imply that if my user doesn't include a value for either the name of the body columns, then they're going to get an error. That error doesn't show up.

What are "requests" and how do they need to be referenced so the rules actually apply?
Watch Question
Fractional CTO
Distinguished Expert 2020
This problem has been solved!
Unlock 2 Answers and 3 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE