1. Go to this page and download the library: Download accolon/izanami library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
$table = new User();
$user = $table->where("id", ">", 2)->limit(5)->getAll();
$table = new User();
$user = $table->where("id", ">", 2)->count();
use Accolon\Izanami\Model;
class User extends Model
{
// One to One
public function phone()
{
return $this->hasOne(Phone::class);
}
// One to Many
public function posts()
{
return $this->hasMany(Post::class);
}
}
class Post extends Model
{
// One to Many (Inverse)
public function user()
{
return $this->belongsToOne(User::class);
}
// Many to Many
public function tags()
{
return $this->morphToMany(Tag::class, 'taggable');
}
}
class Phone extends Model
{
// One to One (Inverse)
public function users()
{
return $this->belongsToMany(User::class);
}
}
class Tag extends Model
{
// Many to Many (Inverse)
public function posts()
{
return $this->morphedByMany(Post::class, 'taggable');
}
}
$table = new User();
// Return boolean
$result = DB::raw("SELECT * FROM test WHERE id = 1");
// Return array
$result = DB::selectRaw("SELECT * FROM test WHERE id = 1");
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.