39 lines
771 B
PHP
39 lines
771 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Frame extends Model
|
|
{
|
|
/**
|
|
* Fetch a specific frame from the database
|
|
*
|
|
* @param int $page
|
|
* @param string $frame
|
|
* @return mixed
|
|
*/
|
|
public function fetch(int $frame,string $index): \App\Classes\Frame
|
|
{
|
|
if ($frame == '999' and $index == 'a')
|
|
{
|
|
return new \App\Classes\Frame(\App\Classes\Frame::testFrame());
|
|
}
|
|
|
|
return new \App\Classes\Frame($this->where('frame',$frame)->where('index',$index)->firstOrFail());
|
|
}
|
|
|
|
public function hasFlag(string $flag)
|
|
{
|
|
// @todo When flags is in the DB update this.
|
|
return isset($this->flags) ? in_array($flag,$this->flags,FALSE) : FALSE;
|
|
}
|
|
|
|
/**
|
|
* Frame Types
|
|
*/
|
|
public function type()
|
|
{
|
|
return $this->type ?: 'i';
|
|
}
|
|
} |