Started work to re-work database; add new models for benchmarks and components
This commit is contained in:
19
src/Models/Benchmark.php
Normal file
19
src/Models/Benchmark.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace BitGoblin\Colossus\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Benchmark extends Model {
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'description',
|
||||
'scoring',
|
||||
];
|
||||
|
||||
public function tests() {
|
||||
return $this->hasMany(Test::class);
|
||||
}
|
||||
|
||||
}
|
18
src/Models/Component.php
Normal file
18
src/Models/Component.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace BitGoblin\Colossus\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Component extends Model {
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'type',
|
||||
];
|
||||
|
||||
public function tests() {
|
||||
return $this->hasMany(Test::class);
|
||||
}
|
||||
|
||||
}
|
@ -8,9 +8,6 @@ class Result extends Model {
|
||||
|
||||
protected $fillable = [
|
||||
'test_id',
|
||||
'component',
|
||||
'benchmark',
|
||||
'type',
|
||||
'average',
|
||||
'minimum',
|
||||
'maximum',
|
||||
|
@ -7,12 +7,21 @@ use Illuminate\Database\Eloquent\Model;
|
||||
class Test extends Model {
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'description',
|
||||
'date_tag',
|
||||
'benchmark_id',
|
||||
'component_id',
|
||||
];
|
||||
|
||||
public function results() {
|
||||
return $this->hasMany(Result::class);
|
||||
}
|
||||
|
||||
public function benchmark() {
|
||||
return $this->belongsTo(Benchmark::class);
|
||||
}
|
||||
|
||||
public function component() {
|
||||
return $this->belongsTo(Component::class);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user