Type Ratings | New Feature (#1360)
* Type Ratings Adding "Type Rating" definition and assignment possibility to v7 core. * Update ProfileController.php * StyleFix 1 * Update settings.yml Change description text as requested
This commit is contained in:
36
app/Models/Typerating.php
Normal file
36
app/Models/Typerating.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Contracts\Model;
|
||||
|
||||
class Typerating extends Model
|
||||
{
|
||||
public $table = 'typeratings';
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'type',
|
||||
'description',
|
||||
'image_url',
|
||||
];
|
||||
|
||||
// Validation
|
||||
public static $rules = [
|
||||
'name' => 'required',
|
||||
'type' => 'required',
|
||||
'description' => 'nullable',
|
||||
'image_url' => 'nullable',
|
||||
];
|
||||
|
||||
// Relationships
|
||||
public function subfleets()
|
||||
{
|
||||
return $this->belongsToMany(Subfleet::class, 'typerating_subfleet', 'typerating_id', 'subfleet_id');
|
||||
}
|
||||
|
||||
public function users()
|
||||
{
|
||||
return $this->belongsToMany(User::class, 'typerating_user', 'typerating_id', 'user_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user