1. Go to this page and download the library: Download memran/marwa-db 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/ */
class User extends Model {
public function posts() {
return $this->hasMany(Post::class);
}
}
class Post extends Model {
public function author() {
return $this->belongsTo(User::class, 'user_id');
}
}
use Marwa\DB\Schema\Schema;
Schema::create('users', function($table) {
$table->increments('id');
$table->string('name')->nullable();
$table->string('email')->unique();
$table->timestamps();
});
'debug' => true
use Marwa\DB\Support\DebugPanel;
DebugPanel::render();