Explore all blogs

419 page expired Laravel error

419 page expired error in Laravel

419 page expired error in Laravel occurs when the valid CSRF token is missing in the post request. Laravel checks the CSRF token in VerifyCsrfToken middleware.

Delete an element from an array in PHP

Delete an element from an array in PHP

To delete an element from an array in PHP, use built-in functions unset(), array_splice(), or array_diff(). Learn how to remove items using these functions.

Get raw SQL query from Laravel Query Builder

Get raw SQL query from Laravel Query Builder

To get raw SQL query from Laravel Query Builder, call toSql() method on the query builder. Use enableQueryLog and getQueryLog methods to get the logged queries.

Create Multiple Where Clause Query Using Laravel Eloquent

How to create multiple where clause query using Laravel eloquent

Multiple where clauses can create by chaining the where() method. You can use orWhere, whereNot, etc to create complex where queries in Laravel Eloquent.

argumentcounterror: array_merge() does not accept unknown named parameters

How to solve error: array_merge() does not accept unknown named parameters

The solve the error “array_merge() does not accept unknown named parameters” upgrade composer to the latest version or downgrade the PHP version to 7.X.

Laravel Cron Job Task Scheduling Tutorial

Laravel Cron Job Task Scheduling Tutorial

To set up cron job task scheduling in Laravel, create a custom artisan command, schedule to run the task in kernel.php, and add task scheduler into crontab.

Laravel Model Events and Observers Tutorial

Laravel Model Events and Observers Tutorial

Learn Laravel eloquent model events, how to create an Observer class, add listeners for different events, and register observers in the EventServiceProvider.

laravel sort by pivot table field

Laravel Order by Pivot Table Field

Learn how to order results by pivot table field in eloquent. Two methods 1) using orderBy in Eager loading 2) Using orderByPivot in lazy loading

Limit Text in Laravel

Limit Text in Laravel

Limit text in Laravel can be done using the Str class from Illuminate\Support\Str namespace for truncating text by character count and word count.

The POST method is not supported for this route. Supported methods: GET, HEAD

The POST method is not supported for this route. Supported methods: GET, HEAD

To solve Laravel error “The POST method is not supported for this route. Supported methods: GET, HEAD”, define the route using ‘post’ or ‘any’ methods.