PHP code example of offworks / laraquent

1. Go to this page and download the library: Download offworks/laraquent 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/ */

    

offworks / laraquent example snippets


$capsule = \Laraquent\Factory::boot([
    'host' => 'localhost',
    'name' => 'mydb',
    'user' => 'root',
    'pass' => ''
    ]);

$schema = new \Laraquent\Schema($capsule->getConnection());

$schema->table('Book', function($table) {
    $table->increments('id');
    $table->string('title');
    $table->string('isbn');
    $table->timestamps();
});

class Article extends \Laraquent\Entity
{
    public function relateAuthor()
    {
        return $this->hasOne('\App\Entity\Author', 'author_id');
    }
}