Initialer Laravel Commit für BetiX
This commit is contained in:
40
app/Models/OperatorCasino.php
Normal file
40
app/Models/OperatorCasino.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class OperatorCasino extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'license_key_hash',
|
||||
'status',
|
||||
'ip_whitelist',
|
||||
'domain_whitelist',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'ip_whitelist' => 'array',
|
||||
'domain_whitelist' => 'array',
|
||||
];
|
||||
|
||||
/**
|
||||
* Look up a casino by its plaintext license key.
|
||||
* Hashes the key and queries by hash — plaintext is never stored.
|
||||
*/
|
||||
public static function findByKey(string $key): ?self
|
||||
{
|
||||
return static::where('license_key_hash', hash('sha256', $key))->first();
|
||||
}
|
||||
|
||||
public function isActive(): bool
|
||||
{
|
||||
return $this->status === 'active';
|
||||
}
|
||||
|
||||
public function sessions()
|
||||
{
|
||||
return $this->hasMany(OperatorSession::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user