Return to site

Laravel eloquent mass update

broken image
broken image

Events allow you to easily execute code each time a specific model class is saved or updated in the database. The easiest way to create a model instance is using the make:model Artisan command:Įloquent models fire several events, allowing you to hook into the following points in a model's lifecycle: retrieved, creating, created, updating, updated, saving, saved, deleting, deleted, restoring, restored. All Eloquent models extend Illuminate\Database\Eloquent\Model class. Models typically live in the app directory, but you are free to place them anywhere that can be auto-loaded according to your composer.json file. To get started, let's create an Eloquent model. For more information on configuring your database, check out the documentation. Models allow you to query for data in your tables, as well as insert new records into the table.īefore getting started, be sure to configure a database connection in config/database.php. Each database table has a corresponding 'Model' which is used to interact with that table.

The Eloquent ORM included with Laravel provides a beautiful, simple ActiveRecord implementation for working with your database.

broken image