PHP code example of ytlmike / laravel-model-creator

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

    

ytlmike / laravel-model-creator example snippets




namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class User extends Model
{
    public function getName()
    {
        return $this->name;
    }
    
    public function setName($name)
    {
        $this->name = $name;
        return $this;
    }
}



namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class User extends Model
{
    /**
     * user name
     * @Column (type='varchar', length=45, not null)
     */
    const FIELD_NAME = 'name';
    
    public function getName()
    {
        return $this->getAttribute(self::FIELD_NAME);
    }
    
    public function setName($name)
    {
        $this->setAttribute(self::FIELD_NAME, $name);
        return $this;
    }
}
SHELL
$ php artisan create:model --const