Usually, after building the model, I have to add the names of the fields to
$allowedFields.This is time-consuming for me.
I don't know exactly whether other developers have experienced this issue or not.
I suggest to add a
new option to command
php spark make:modelfor this issue.
Option -for takes the name of the table and adds the fields to
$allowedFields
to generate the model.
I think this option helps a lot in saving the developer's time.
Code:
Data of Table "sms_sender":
+----+--------------+------+------+----+---------------+--------+------------+------------+------------+
| id | message_text | type | from | to | send_datetime | status | created_at | updated_at | deleted_at |
+----+--------------+------+------+----+---------------+--------+------------+------------+------------+
Code:
php spark make:model -for sms_sender
PHP Code:
protected $DBGroup = 'default';
protected $table = 'sms_sender';
protected $primaryKey = 'id';
protected $useAutoIncrement = true;
protected $returnType = 'array';
protected $useSoftDeletes = true;
protected $protectFields = true;
protected $allowedFields = [
'message_text',
'type',
'from',
'to',
'send_datetime',
'status'
];