<?php
namespace App\Models;
use ...
class Company extends Model
{
protected $fillable = [
'user_id',
'name',
'short_name',
'type',
];
public static array $allowedFields = [
'name'
];
// Which fields can be used to sort the results through the query string
public static array $allowedSorts = [
'name',
'created_at'
];
// Which fields can be used to filter the results through the query string
public static array $allowedFilters = [
'name'
];
public function token(): HasMany
{
return $this->hasMany(Token::class);
}
<?php
namespace App\Models;
use ...
class Company extends Model
{
protected $fillable = [
'user_id',
'name',
'short_name',
'type',
];
public static array $allowedFields = [
'name'
];
// Which fields can be used to sort the results through the query string
public static array $allowedSorts = [
'name',
'created_at'
];
// Which fields can be used to filter the results through the query string
public static array $allowedFilters = [
'name'
];
public function token(): HasMany
{
return $this->hasMany(Token::class);
}