PHP code example of ignasbernotas / laravel-model-generator

1. Go to this page and download the library: Download ignasbernotas/laravel-model-generator 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/ */

    

ignasbernotas / laravel-model-generator example snippets




public function register()
{
    if ($this->app->environment() == 'local') {
        $this->app->register('Iber\Generator\ModelGeneratorProvider');
    }
}



namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Users extends Model {

    public $timestamps = false;

    protected $table = 'users';

    protected $fillable = ['username', 'email', 'name'];

    protected $guarded = ['id', 'password'];

}



namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Posts extends Model {

    public $timestamps = true;

    protected $table = 'posts';

    protected $fillable = ['title', 'content', 'created_at', 'updated_at'];

    protected $guarded = ['id'];

}
sh
php artisan make:models