gruene-seele/app/Models/Logger.php
2021-01-08 17:48:20 +01:00

83 lines
2.3 KiB
PHP

<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use App\User;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
/**
* Class Logger
*
* @property int $id
* @property int $user_id
* @property int $model_id
* @property string $model
* @property string $action
* @property string $channel
* @property string $message
* @property int $level
* @property Carbon $created_at
* @property Carbon $updated_at
* @property User $user
* @package App\Models
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Logger newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Logger newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Logger query()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Logger whereAction($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Logger whereChannel($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Logger whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Logger whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Logger whereLevel($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Logger whereMessage($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Logger whereModel($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Logger whereModelId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Logger whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Logger whereUserId($value)
* @mixin \Eloquent
*/
class Logger extends Model
{
protected $table = 'loggers';
protected $casts = [
'user_id' => 'int',
'model_id' => 'int',
'level' => 'int'
];
protected $fillable = [
'user_id',
'model_id',
'model',
'action',
'channel',
'message',
'level'
];
public $levelTypes = [
1 => 'debug',
2 => 'info',
3 => 'notice',
4 => 'warning',
5 => 'error',
6 => 'critical',
7 => 'alert',
];
public function user()
{
return $this->belongsTo(User::class);
}
public function getLevelType(){
return isset($this->levelTypes[$this->level]) ? $this->levelTypes[$this->level] : "";
}
}