Laravel-MongoDB CRUD

Create Model

Laravel's Eloquent ORM provides mapping between database resources and models. In relational database, models correspond to tables. In MongoDB, models correspond to collections. The MongoDB package (jenssegers/laravel-mongodb) provides Moloquent ORM which is an extension of Eloquent. We can use Moloquent to create models.

Usually, there is a model corresponding to every collection.The name of our collection is books(plural). So we create a corresponding model Book(singular), following the Laravel naming convention. These conventions are not strict, but its best to adhere to them to avoid confusion. You may create the model file manually, or using the artisan CLI.