Few questions about Laravel and few common mistakes in Laravel.

Let’s talk about few questions about Laravel.

What is route in Laravel?

– In Laravel, routing means to route any request to a suitable controller. It can be defined through app/http/routes.php file.

What is middleware in Laravel?

– Basically It’s a mid person between request and response. It can be created with following command:

php artisan make:middleware <middleware-name>

What is CSRF token in Laravel?

– Laravel providing a easy way to project your application from CSRF attacks. It automatically generates a CSRF token for user session. It will make sure that only authentic user can make request.

What is Artisan in Laravel?

– It’s a command line interface inbuilt with Laravel which provides lots of helpful commands that you can use while developing your application.

What is blade in Laravel?

– It’s a powerful template engine provided with Laravel. You can use plain php code also in this. Files should come with .blade.php and typically stored in resources/views.

 

Now let’s talk about few common mistakes in Laravel.

MethodNotAllowedException error in Laravel.

– While dealing with Http request, this error occurs when we define wrong method in part of a form or in route. Basically this time you need to check methods which are Get , Post. So in all places use only one either Get or Post.

TokenMismatchException in VerifyCsrfToken.php error in Laravel.

– In Laravel, if you are using a form then you should use hidden csrf token field in form. We can use csrf_field. So sometimes if its not defined properly then this error may appear.

NotFoundHttpException in RouteCollection.php error in Laravel.

– It usually happens when a route is not exists or not correctly mentioned when you are trying to access that.

Class “User” not found error in Laravel.

This happens when you haven’t informed Laravel about class properly.