hasMany(Frame::class); } /** * Return a frame class for the Model * * @param Model $o * @return FrameClass * @throws \Exception */ public function frame(Model $o): FrameClass { switch (strtolower($this->name)) { case 'ansi': return new AnsiFrame($o); case 'videotex': return new VideotexFrame($o); default: throw new \Exception('Unknown Frame type: '.$mo->name); } } /** * Fetch a specific frame from the DB * * @param int $frame * @param string $index * @param Server $so * @return FrameClass * @throws \Exception */ public function frameLoad(int $frame,string $index,Server $so): FrameClass { return $this->frame( // Return our internal test frame. ($frame == '999' and $index == 'a') ? $so->testFrame() : $this->frames() ->where('frame','=',$frame) ->where('index','=',$index) ->firstOrFail() ); } /** * Return our server instance */ public function server() { switch (strtolower($this->name)) { case 'ansi': return new AnsiServer($this); case 'videotex': return new VideotexServer($this); default: throw new \Exception('Unknown server type: '.$this->name); } } }