2023-11-23 19:27:43 +01:00
|
|
|
<?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';
|
|
|
|
|
2023-11-24 00:16:43 +01:00
|
|
|
/**
|
|
|
|
* Override the default column used in the route.
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getRouteKeyName()
|
|
|
|
{
|
|
|
|
return 'channel_login';
|
|
|
|
}
|
|
|
|
|
2023-11-23 19:27:43 +01:00
|
|
|
/**
|
|
|
|
* Get the messages posted in the channel
|
|
|
|
*/
|
|
|
|
public function messages()
|
|
|
|
{
|
|
|
|
return $this->hasMany(Message::class, 'channel_id', 'channel_id');
|
|
|
|
}
|
|
|
|
|
2023-11-24 00:16:43 +01:00
|
|
|
/**
|
|
|
|
* Get the moderator actions in the channel
|
|
|
|
*/
|
|
|
|
public function actions()
|
|
|
|
{
|
|
|
|
return $this->hasMany(ModeratorAction::class, 'channel_id', 'channel_id');
|
|
|
|
}
|
|
|
|
|
2023-11-23 19:27:43 +01:00
|
|
|
/**
|
|
|
|
* Get the channel's username.
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function username()
|
|
|
|
{
|
|
|
|
return $this->channel_login;
|
|
|
|
}
|
|
|
|
}
|