How-to articles, tricks, and solutions about LARAVEL-4

Could not open input file: artisan

It looks like you are trying to run the artisan command but are getting an error saying that the input file could not be found.

Displaying the Error Messages in Laravel after being Redirected from controller

In Laravel, you can use the withErrors method to pass error messages to a view after a redirect.

Eloquent model mass update

To update multiple records in the Eloquent ORM (Object-Relational Mapping) in Laravel, you can use the update() method on the query builder or on a model instance.

How Can I Remove “public/index.php” in the URL Generated Laravel?

To remove "public/index.php" from the URL in a Laravel application, you can use the built-in PHP web server or set up a web server with Apache or Nginx.

How to alias a table in Laravel Eloquent queries (or using Query Builder)?

To alias a table in a Laravel Eloquent query, you can use the as method on a DB facade.

How to get all rows (soft deleted too) from a table in Laravel?

In Laravel, you can use the withTrashed() method to retrieve all the rows, including the soft deleted ones, from a table.

How to reload/refresh model from database in Laravel?

In Laravel, you can use the refresh method on a model instance to reload the model's attributes from the database.

Laravel Check If Related Model Exists

In Laravel, you can use the exists method on a relationship to check if it has any related models.

Laravel Delete Query Builder

In Laravel, you can use the Query Builder to delete records from a database table.

Laravel Eloquent - Attach vs Sync

Here's an example that demonstrates the difference between using attach() and sync() in Laravel Eloquent:

Laravel Eloquent LEFT JOIN WHERE NULL

In Laravel, you can use the leftJoin method on a query builder instance to perform a left join, and then use the whereNull method to only include records where a column from the right-hand table is null:

Laravel orderBy on a relationship

In Laravel, you can use the orderBy method on a relationship to sort the results of the relationship by a given column.

Laravel: How to get last N entries from DB

You can use the latest method on a query builder instance to get the last N entries from the database.

PHP Composer update "cannot allocate memory" error (using Laravel 4)

This error can occur when the composer process is trying to allocate more memory than is available to it.

What are the Differences Between "php artisan dump-autoload" and "composer dump-autoload"?

php artisan dump-autoload is a command that is part of the Artisan command-line interface included with Laravel.