Eloquent: Getting Started | Laravel DB insert or update
IntroductionLaravelincludesEloquent,anobject-relationalmapper(ORM)thatmakesitenjoyabletointeractwithyourdatabase.WhenusingEloquent,eachdatabasetablehasacorresponding"Model"thatisusedtointeractwiththattable.Inadditiontoretrievingrecordsfromthedatabasetable,Eloquentmodelsallowyoutoinsert,update,anddeleterecordsfromthetableaswell.{tip}Beforegettingstarted,besuretoconfigureadatabaseconnectioninyourapplicationsconfig/database.phpconfigurationfile.Formoreinformationonconfiguringyourdatabase,checko...
IntroductionLaravel includes Eloquent, an object-relational mapper (ORM) that makes it enjoyable to interact with your database. When using Eloquent, each database table has a corresponding "Model" that is used to interact with that table. In addition to retrieving records from the database table, Eloquent models allow you to insert, update, and delete records from the table as well.
{tip} Before getting started, be sure to configure a database connection in your applications config/database.php configuration file. For more information on configuring your database, check out the database configuration documentation[1].
Generating Model ClassesTo get started, lets create an Eloquent model. Models typically live in the appModels directory and extend the IlluminateDatabaseEloquentModel class. You may use the make:model Artisan command[2] to generate a new model:
php artisan make:model FlightIf you would like to generate a database migration[3] when...