Package Data | |
---|---|
Maintainer Username: | gaoj87 |
Maintainer Contact: | gaoj87@163.com (gaoj87) |
Package Create Date: | 2017-05-19 |
Package Last Update: | 2020-05-05 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-11 15:21:22 |
Package Statistics | |
---|---|
Total Downloads: | 33 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 1 |
Total Forks: | 0 |
Total Open Issues: | 0 |
crud for laravel & lumen
fork from https://github.com/funson86/laravel-crud-generator
The preferred way to install this extension is through composer.
Either run
php composer.phar require gaoj87/laravel-crud-generator @dev
or add
"gaoj87/laravel-crud-generator": "@dev"
to the require section of your composer.json
file.
Usage: Command: crud-model {name} {--table=} {--prefix=}
example:
➜ php artisan crud-model Models/Users --table=users --prefix=
Then:
<?php
namespace XXX;
use Illuminate\Database\Eloquent\Model;
/**
* This is the model class for table "users".
* @property integer $id
* @property integer $mid
* @property string $real_name
* @property string $mobile
* @property string $created_at
* @property string $updated_at
*/
class Users extends Model
{
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'users';
/**
* The primary key for the model.
*
* @var string
*/
protected $primaryKey = 'id';
/**
* The name of the "created at" column.
*
* @var string
*/
const CREATED_AT = 'created_at';
/**
* The name of the "updated at" column.
*
* @var string
*/
const UPDATED_AT = 'updated_at';
/**
* Attributes that should be mass-assignable.
*
* @var array
*/
protected $fillable = [
'mid',
'real_name',
'mobile',
];
/**
* Returns the text label for the specified attribute or all attribute labels.
* @param string $key the attribute name
* @return array|string the attribute labels
*/
public static function attributeLabels($key = null)
{
$data = [
'id' => 'Id',
'mid' => 'Mid',
'real_name' => 'Real Name',
'mobile' => 'Mobile',
'created_at' => 'Created At',
'updated_at' => 'Updated At',
];
if ($key !== null) {
return isset($data[$key]) ? $data[$key] : null;
} else {
return $data;
}
}
}