Lae/app/Models/Module/Provider.php
2022-08-13 16:37:17 +08:00

31 lines
594 B
PHP

<?php
namespace App\Models\Module;
use Illuminate\Support\Str;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class Provider extends Model
{
use HasFactory;
protected $table = 'providers';
protected $fillable = [
'name',
'api_token',
];
protected static function boot()
{
parent::boot();
static::creating(function ($model) {
// if local
if (!app()->environment('local')) {
$model->api_token = Str::random(60);
}
});
}
}