51 lines
974 B
PHP
51 lines
974 B
PHP
<?php
|
|
|
|
namespace App\Models\Trace;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Channel extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $connection = 'trace_tmi';
|
|
protected $table = 'configs';
|
|
|
|
/**
|
|
* Override the default column used in the route.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getRouteKeyName()
|
|
{
|
|
return 'channel_login';
|
|
}
|
|
|
|
/**
|
|
* Get the messages posted in the channel
|
|
*/
|
|
public function messages()
|
|
{
|
|
return $this->hasMany(Message::class, 'channel_id', 'channel_id');
|
|
}
|
|
|
|
/**
|
|
* Get the moderator actions in the channel
|
|
*/
|
|
public function actions()
|
|
{
|
|
return $this->hasMany(ModeratorAction::class, 'channel_id', 'channel_id');
|
|
}
|
|
|
|
/**
|
|
* Get the channel's username.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function username()
|
|
{
|
|
return $this->channel_login;
|
|
}
|
|
}
|