GithubHelp home page GithubHelp logo

pjijin / laravel-common-errors-cheatsheet Goto Github PK

View Code? Open in Web Editor NEW
9.0 2.0 0.0 16 KB

📋Laravel Common Error Cheatsheet

Home Page: https://pjijin.github.io/Laravel-Common-Errors-Cheatsheet/

laravel laravel5 laravel56 laravel55 errors error-messages error-pages

laravel-common-errors-cheatsheet's Introduction

Laravel Common Errors Cheatsheet

⚡ Laravel Common Error Cheatsheet for beginners.

🔍 Use Ctrl + F to search for error

🥳 Feel free to contribute


Error 1

`SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) (SQL: select count(*) as aggregate from` users`where`email `= [email protected])`

Solution

Make sure the database details are correct on the .env file

DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=your_database_name DB_USERNAME=your_database_username DB_PASSWORD=your_database_password


Error 2

419 sorry your session has expired. please refresh and try again

or

TokenMismatchException

Solution

The error basically occurs when there is no csrf token field on the form post. Make sure you have {{ csrf_filed() }} on the blade form.


Error 3

404 Sorry, the page you are looking for could not be found.

or

NotFoundHttpException

Solution

You have not added the Route. Go to routes/web.php and specify the route.


Error 4

405 Method not allowed

or

MethodNotAllowedHttpException

Solution

You have not added the Route or it is not in Route::post method . Go to routes/web.php and specify the route or modify the route to post method.


Error 5

Class App\Http\Controllers\HomeController does not exist

Solution

You have not created the HomeController file. Go to your terminal and run php artisan make:controller HomeController


Error 6

Method App\Http\Controllers\HomeController::test does not exist.

Solution

You have not created the specified method on HomeController. Here the test method is not added in HomeController.


Error 7

View [sample] not found.

Solution

The template blade file is not present on the specified directory. Make sure you have created the sample.blade.php file on resources/views folder.


Error 8

Class 'App\Http\Controllers\admin\Auth' not found

Solution

To use the Auth Namespace you need to import it at the top. Use Auth;


Error 9

SQLSTATE[HY000] General error: 1364 Field 'email' doesn't have a default value

Solution

You need to pass the value to the Model at the time of creating new record. Or you need to make the field nullable in migration ->nullable and run php artisan migrate:fresh


Error 10

ModelNotFoundException

Solution

This exception is thrown if you try to access the data that does not exist. Generally thrown by findOrFail() or firstOrFail()


Error 11

Cannot end a section without first starting one

This error will be at the blade file. Check that you have a starting of section Eg: @section('content')


laravel-common-errors-cheatsheet's People

Contributors

pjijin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.