Created frames table with migration

This commit is contained in:
Deon George
2018-12-03 23:59:22 +11:00
parent 4504818e25
commit 3651a6508a
11 changed files with 1049 additions and 732 deletions

View File

@@ -13,25 +13,14 @@ class Frame extends Model
* @param string $frame
* @return mixed
*/
public function fetch(int $page,string $frame): \App\Classes\Frame
public function fetch(int $frame,string $index): \App\Classes\Frame
{
if ($page == '999' and $frame == 'a')
if ($frame == '999' and $index == 'a')
{
return new \App\Classes\Frame(\App\Classes\Frame::testFrame());
}
return new \App\Classes\Frame($this->where('frame_id',$page)->where('subframe_id',$frame)->firstOrFail());
}
/**
* Return the frame cost
*
* @return int
*/
public function getCostAttribute()
{
// @todo NOT in DB
return rand(0,999);
return new \App\Classes\Frame($this->where('frame',$frame)->where('index',$index)->firstOrFail());
}
public function hasFlag(string $flag)
@@ -45,7 +34,6 @@ class Frame extends Model
*/
public function type()
{
// @todo in DB
return isset($this->frametype) ? $this->frametype : 'i';
return $this->type ?: 'i';
}
}