mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-03 15:02:34 +00:00
Add site redirects (#552)
* feat(redirects): add redirects to sites * chore(style): fixed coding style issues * style: fix php-stan docblocks * style: pint cleanup * tests: fixed redirect test suite * feat: vhosts include additional configs * fix: use exact location matching * - add enums - use queues - use vhost rather than separate conf files - vhost formatter - cleanup * generate docs --------- Co-authored-by: Saeed Vaziry <mr.saeedvaziry@gmail.com>
This commit is contained in:
49
app/Models/Redirect.php
Normal file
49
app/Models/Redirect.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\RedirectStatus;
|
||||
use Database\Factories\RedirectFactory;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property int $site_id
|
||||
* @property string $from
|
||||
* @property string $to
|
||||
* @property string $mode
|
||||
* @property string $status
|
||||
* @property Site $site
|
||||
*/
|
||||
class Redirect extends AbstractModel
|
||||
{
|
||||
/** @use HasFactory<RedirectFactory> */
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'site_id',
|
||||
'from',
|
||||
'to',
|
||||
'mode',
|
||||
'status',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array<string, string>
|
||||
*/
|
||||
public static array $statusColors = [
|
||||
RedirectStatus::CREATING => 'warning',
|
||||
RedirectStatus::READY => 'success',
|
||||
RedirectStatus::DELETING => 'warning',
|
||||
RedirectStatus::FAILED => 'danger',
|
||||
];
|
||||
|
||||
/**
|
||||
* @return BelongsTo<Site, covariant $this>
|
||||
*/
|
||||
public function site(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Site::class);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user