PhyrePanel/web/app/Models/HostingDatabase.php
Bozhidar Slaveykov 67cd7ec58b update
2024-04-06 16:01:46 +03:00

38 lines
745 B
PHP

<?php
namespace App\Models;
use App\ShellApi;
use Illuminate\Database\Eloquent\Model;
class HostingDatabase extends Model
{
protected $fillable = [
'database_name',
'database_username',
'database_password',
];
public static function boot()
{
parent::boot();
static::creating(function ($model) {
$createDbAndUser = ShellApi::callBin('mysql-create-db-and-user', [
$model->database_name,
$model->database_username,
$model->database_password,
]);
if (empty($createDbAndUser)) {
return false;
}
});
static::deleting(function ($model) {
});
}
}