https://github.com/laravellegends/interactive-model
This library is helpful to record data in the Eloquent models interactively via the command line.
https://github.com/laravellegends/interactive-model
artisan artisan-command laravel model
Last synced: 10 months ago
JSON representation
This library is helpful to record data in the Eloquent models interactively via the command line.
- Host: GitHub
- URL: https://github.com/laravellegends/interactive-model
- Owner: LaravelLegends
- Created: 2021-03-17T13:13:53.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-11-18T13:05:21.000Z (over 4 years ago)
- Last Synced: 2025-04-30T15:57:26.850Z (10 months ago)
- Topics: artisan, artisan-command, laravel, model
- Language: PHP
- Homepage:
- Size: 31.3 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Laravel Legends Interactive Model
This is a Laravel package to help you to record data in the Eloquent models interactively via the command line.
## Instalation
Now, run in terminal:
```bash
composer require laravellegends/interactive-model
```
## Usage examples
Example:
```bash
php artisan model:interactive User
```
or
```bash
php artisan model:interactive App\\Models\\User
```
```text
Type the "name" value:
> Wallace Maxters
Type the "email" value:
> wallacemaxters@test.com
Type the "password" value:
> [automatic hidden]
Data inserted in table users
```
This command assume that your models is placed in `App\Models` namespace by default, if you not passed full namespace as argument.
The data asked to fill should be defined in `$fillable` in your model. For fields placed in `$hidden`, the prompt is automatically hidden.
Example:
```php
namespace App\Models;
class User extends Model
{
protected $fillable = ['name', 'email', 'password'];
protected $hidden = ['password'];
}
```