mirror of
https://github.com/the-programmers-hangout/Mimic.git
synced 2026-09-04 09:16:00 +02:00
init
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Config extends Model
|
||||
{
|
||||
protected $fillable = ['key', 'value'];
|
||||
|
||||
public static function get($key, $default = null)
|
||||
{
|
||||
$config = self::where('key', $key)->first();
|
||||
|
||||
return $config ? $config->value : $default;
|
||||
}
|
||||
|
||||
public static function set($key, $value)
|
||||
{
|
||||
return self::updateOrCreate(['key' => $key], ['value' => $value]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Mime extends Model
|
||||
{
|
||||
protected $fillable = ['mime', 'handling'];
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
|
||||
class User extends Model
|
||||
{
|
||||
use HasApiTokens;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'username',
|
||||
'discord_id',
|
||||
'is_admin',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array<string>
|
||||
*/
|
||||
protected $casts = [
|
||||
'is_admin' => 'boolean',
|
||||
];
|
||||
|
||||
/**
|
||||
* The highlighted Discord ID.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getHighlightAttribute()
|
||||
{
|
||||
return "<@{$this->discord_id}>";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user