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.
To create a model you can use artisan as a generator tool.
➣ 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
{
/**
* Undocumented variable
*
* @var $table adalah nama tabel dari model anda
* @var $fillable adalah kolom apa saja yang anda ijinkan untuk diisi
* @method FunctionName adalah method yang anda definisikan untuk model
*
* @return any
*
* protected $table = 'Examples';
*
* protected $fillable = ['name','email','password'];
* public function FunctionName(Type $var = null)
* {
* # code..
* }
*/
}
everything you need to do the data interaction is already prepared.