Models
Table of contents
Introduction
The model represents the data structure. Usually the model contains functions that help someone in managing the database such as entering data into database, update data and others.
The model on Harmony is adapted from Eloquent so it is very easy to model the data to interact with each other.
How to create Model?
To create a model you can use artisan as a generator tool.
- Open the terminal / Commad Prompt on your computer.
- Navigate to your Harmony Framework project directory.
- Type the command
php artisan make:model <name-model>
- Press Enter
$ php artisan make:model Users
File created (Users.php) in app/Models/Users.php
The Users.php
file located in app/Models
looks like this:
# app/Models/Users.php
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Users extends Model
{
/**
* Write your code
*/
}
everything you need to do the data interaction is already prepared.
hidden
hidden