PHP code example of wenjy / laravel-model-gen

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

    

wenjy / laravel-model-gen example snippets



/**
 * @date: 2024-02-04 05:39:19
 */

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Carbon;


/**
 * This is the model class for table "测试评论表".
 * @property int $id
 * @property string $title 评论标题
 * @property int $post_id 文章ID
 * @property Carbon|null $created_at
 * @property Carbon|null $updated_at
 * @property string $aaa
 * @property string|null $v
 * @property string $w aaaa
 * @property array|null $a json aa
 * @property array|null $json1 json 1
 * @property array|null $json2
 */
class TestComment extends Model
{
    use HasFactory;

    /**
     * @var string
     */
    protected $table = 'test_comments';

    /**
     * @var array
     */
    protected $fillable = [
        'title',
        'post_id',
        'aaa',
        'v',
        'w',
        'a',
        'json1',
        'json2',
    ];

    /**
     * @var array
     */
    protected $casts = [
        'a' => 'array',
        'json1' => 'array',
        'json2' => 'array',
    ];
}