This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
vbbs/app/Models/Frame.php

39 lines
771 B
PHP
Raw Normal View History

2018-12-01 21:50:34 +00:00
<?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
*/
2018-12-03 12:59:22 +00:00
public function fetch(int $frame,string $index): \App\Classes\Frame
2018-12-01 21:50:34 +00:00
{
2018-12-03 12:59:22 +00:00
if ($frame == '999' and $index == 'a')
2018-12-01 21:50:34 +00:00
{
return new \App\Classes\Frame(\App\Classes\Frame::testFrame());
}
2018-12-03 12:59:22 +00:00
return new \App\Classes\Frame($this->where('frame',$frame)->where('index',$index)->firstOrFail());
2018-12-01 21:50:34 +00:00
}
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()
{
2018-12-03 12:59:22 +00:00
return $this->type ?: 'i';
2018-12-01 21:50:34 +00:00
}
}