PHP code example of corex / lmodel
1. Go to this page and download the library: Download corex/lmodel 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/ */
corex / lmodel example snippets
return [
'path' => base_path('app/Models'),
'namespace' => 'App\Models',
'addConnection' => true,
'extends' => \Illuminate\Database\Eloquent\Model::class,
'indent' => "\t",
'length' => 120,
'const' => [
'{connection}' => [
'{table}' => [
'id' => '{id}',
'name' => '{name}',
'prefix' => '{prefix}',
'suffix' => '{suffix}',
'replace' => [
'XXXX' => 'YYYY',
]
]
]
]
];
if ($this->app->environment() == 'local') {
$this->app->register('CoRex\Laravel\Model\ModelServiceProvider');
}
artisan help make:models
namespace App\Models\Test;
use Illuminate\Database\Eloquent\Model;
/**
* @property integer $id [TYPE=INTEGER, NULLABLE=0, DEFAULT=""]
* @property string $name [TYPE=STRING, NULLABLE=0, DEFAULT=""]
* @property string $value [TYPE=STRING, NULLABLE=0, DEFAULT=""]
*/
class Status extends Model
{
// Constants.
const CONSTANT1 = 1;
const CONSTANT2 = 2;
const CONSTANT3 = 3;
const CONSTANT4 = 4;
// Attributes.
public $timestamps = false;
protected $connection = 'mysql';
protected $table = 'status';
protected $fillable = ['id', 'name', 'value'];
protected $guarded = [];
/* ---- Everything after this line will be preserved. ---- */
/**
* Preserve this method.
*
* @return string
*/
public function preserveThisMethod()
{
return 'preserved';
}
}