composer require rapid/laplus
Run this command to publish configs to config/laplus.php
php artisan vendor:publish --tag=laplus
- Add
HasPresent
trait:
class User extends Model
{
use HasPresent;
}
- Remove
$fillable
,$hidden
andcasts()
values:
//protected $fillable = ['name', 'email', 'password'];
//protected $hidden = ['password', 'remember_token'];
//protected function casts() { ... }
Laplus will automatically add this values.
- Create
UserPresent
class with the following command:
php artisan make:user-present
Or add below code in User class:
protected function present(Present $present)
{
$present->id();
$present->string('name');
$present->string('email')->unique();
$present->timestamp('email_verified_at')->nullable();
$present->password();
$present->rememberToken();
$present->timestamps();
}
- Move default migration to laplus path:
Find database/migrations/0001_01_01_000000_create_users_table.php
file and move it
into database/migrations/auto_generated
folder (create it if doesn't exists)