In PHP, models refer to classes that are used to manipulate data and perform data logic actions such as deleting, updating, retrieving, and inserting. Model classes in Laravel are usually stored in the app/directory. In this post, I will show you how you can easily create a model in Laravel to perform various functionalities.
How to Create a Model in Laravel
Laravel PHP makes it very easy for you to create models. Here are a few steps you should follow:
Step 1: To get started, create a new Laravel project in your XAMP folder using the commands below
composer create-project --prefer-dist laravel/laravel LaravelModel |
Our project has been successfully created. Now let’s proceed to create a model.
Step 2: To create a model, navigate to your project directory and run the following command
php artisan make:model Page |
We have successfully created our model
Step 3: To confirm it, open your app/models and our Page model has been created there
In this laravel example tutorial we covered how to creat Model in laravel
Article Contributed By :
|
|
|
|
671 Views |