28 lines
440 B
PHP
28 lines
440 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Models;
|
||
|
|
||
|
use Illuminate\Database\Eloquent\Builder;
|
||
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
||
|
class Mode extends Model
|
||
|
{
|
||
|
/**
|
||
|
* Return our server instance
|
||
|
*/
|
||
|
public function server()
|
||
|
{
|
||
|
switch ($this->name) {
|
||
|
case 'Ansi':
|
||
|
case 'VideoTex':
|
||
|
$class = 'App\\Classes\\Server\\'.$this->name;
|
||
|
|
||
|
break;
|
||
|
|
||
|
default:
|
||
|
throw new \Exception('Unknown server type: '.$this->name);
|
||
|
}
|
||
|
|
||
|
return new $class;
|
||
|
}
|
||
|
}
|