added primary keys to all models

This commit is contained in:
2021-03-10 23:29:30 +09:00
parent 91bde37441
commit 4db6dac439
35 changed files with 197 additions and 19 deletions

View File

@@ -9,6 +9,9 @@ class AllowedLogin extends Model
//Table Name
public $table = 'allowed_logins';
//Primary Key
public $primaryKey = 'id';
//Timestamps
public $timestamps = true;

View File

@@ -0,0 +1,41 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class AfterActionReport extends Model
{
//Table Name
public $table = '';
//Primary Key
public $primaryKey = 'id';
//Timestamps
public $timestamps = true;
/**
* The attributes that are mass assignable
*
* @var array
*/
protected $fillable = [
'fc_id',
'fc_name',
'formup_location',
'comms',
'doctrine',
'objective',
'objective_result',
'summary',
'improvements',
'worked_well',
'additional_comments',
];
public function comments() {
return $this->hasMany(App\Models\AfterActionReports\AfterActionReportComment::class, 'report_id', 'id');
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class AfterActionReportComment extends Model
{
//Table Name
public $table = '';
//Primary Key
public $primaryKey = 'id';
//Timestamps
public $timestamps = true;
/**
* The attributes that are mass assignable
*
* @var array
*/
protected $fillable = [
'report_id',
'character_id',
'character_name',
'comments',
];
public function report() {
$this->belongsTo(App\Models\AfterActionReports\AfterActionReport::class, 'id', 'report_id');
}
}

View File

@@ -9,6 +9,9 @@ class BlacklistEntity extends Model
//Table Name
public $table = 'alliance_blacklist';
//Primary Key
public $primaryKey = 'id';
//Timestamps
public $timestamps = true;

View File

@@ -9,6 +9,9 @@ class SupplyChainBid extends Model
//Table Name
public $table = 'supply_chain_bids';
//Primary Key
public $primaryKey = 'id';
// Timestamps
public $timestamps = true;
@@ -29,11 +32,11 @@ class SupplyChainBid extends Model
//Relationships
public function ContractId() {
return $this->hasOne('App\Models\Contracts\SupplyChainContract', 'contract_id', 'contract_id');
return $this->belongsTo(App\Models\Contracts\SupplyChainContract::class, 'contract_id', 'contract_id');
}
public function Contract() {
return $this->belongsTo(SupplyChainContract::class);
return $this->belongsTo(App\Models\Contracts\SupplyChainContract::class);
}
//Model functions

View File

@@ -9,6 +9,9 @@ class SupplyChainContract extends Model
//Table Name
public $table = 'supply_chain_contracts';
//Primary Key
public $primaryKey = 'id';
//Timestamps
public $timestamps = true;

View File

@@ -9,6 +9,9 @@ class EsiScope extends Model
// Table Name
protected $table = 'EsiScopes';
//Primary Key
public $primaryKey = 'id';
// Timestamps
public $timestamps = true;
@@ -23,6 +26,6 @@ class EsiScope extends Model
];
public function user() {
return $this->belongsTo('App\Models\User\User', 'character_id', 'character_id');
return $this->belongsTo(App\Models\User\User::class, 'character_id', 'character_id');
}
}

View File

@@ -28,7 +28,11 @@ class EsiToken extends Model
'expires_in',
];
public function user() {
return $this->belongsTo(App\Models\User\User::class, 'character_id', 'character_id');
}
public function esiscopes() {
return $this->hasMany('App\Models\EsiScope', 'character_id', 'character_id');
return $this->hasMany(App\Models\EsiScope::class, 'character_id', 'character_id');
}
}

View File

@@ -11,6 +11,9 @@ class AllianceWalletJournal extends Model
*/
protected $table = 'alliance_wallet_journal';
//Primary Key
public $primaryKey = 'id';
/**
* Timestamps
*/

View File

@@ -9,6 +9,9 @@ class JobStatus extends Model
//Table Name
public $table = 'job_statuses';
//Primary Key
public $primaryKey = 'id';
//Timestamps
public $timestaps = true;

View File

@@ -9,6 +9,9 @@ class AllianceLookup extends Model
//Table Name
public $table = 'alliance_lookup';
//Primary Key
public $primaryKey = 'id';
//Timestamps
public $timestamps = false;

View File

@@ -9,6 +9,9 @@ class CharacterLookup extends Model
//Table Name
public $table = 'character_lookup';
//Primary Key
public $primaryKey = 'id';
//Timestamps
public $timestamps = false;

View File

@@ -9,6 +9,9 @@ class CorporationLookup extends Model
//Table Name
public $table = 'corporation_lookup';
//Primary Key
public $primaryKey = 'id';
//Timestamps
public $timestamps = false;

View File

@@ -11,6 +11,9 @@ class ItemLookup extends Model
*/
public $table = 'item_lookup';
//Primary Key
public $primaryKey = 'id';
/**
* Timestamps
*/

View File

@@ -9,6 +9,9 @@ class SolarSystem extends Model
//Table Name
public $table = 'solar_systems';
//Primary Key
public $primaryKey = 'id';
//Timestamps
public $timestamps = false;

View File

@@ -9,6 +9,9 @@ class SentMail extends Model
//Table Name
protected $table = 'sent_mails';
//Primary Key
public $primaryKey = 'id';
//Timestamps
public $timestamps = false;

View File

@@ -9,6 +9,9 @@ class Invoice extends Model
//Table Name
protected $table = 'alliance_mining_tax_invoices';
//Primary Key
public $primaryKey = 'id';
//Timestamps
public $timestamps = true;
@@ -28,7 +31,7 @@ class Invoice extends Model
];
public function getPayment() {
return $this->hasMany('App\Models\MiningTax\Payment', 'invoice_id', 'invoice_id');
return $this->hasOne(App\Models\MiningTax\Payment::class, 'invoice_id', 'invoice_id');
}
public function getCharacterId() {
@@ -44,7 +47,7 @@ class Invoice extends Model
}
public function getLedgers() {
return $this->hasMany('App\Models\MiningTax\Ledger', 'invoice_id', 'invoice_id');
return $this->hasMany(App\Models\MiningTax\Ledger::class, 'invoice_id', 'invoice_id');
}
public function getInvoiceAmount() {

View File

@@ -9,6 +9,9 @@ class Ledger extends Model
//Table Name
protected $table = 'alliance_mining_tax_ledgers';
//Primary Key
public $primaryKey = 'id';
//Timestamps
public $timestamps = false;
@@ -31,7 +34,7 @@ class Ledger extends Model
];
public function getInvoice() {
return $this->belongsTo('App\Models\MiningTax\Invoice', 'invoice_id', 'invoice_id');
return $this->belongsTo(App\Models\MiningTax\Invoice::class, 'invoice_id', 'invoice_id');
}

View File

@@ -9,6 +9,9 @@ class Observer extends Model
//Table Name
protected $table = 'alliance_mining_tax_observers';
//Primary Key
public $primaryKey = 'id';
//Timestamps
public $timestamps = true;
@@ -21,11 +24,5 @@ class Observer extends Model
'last_updated',
'observer_id',
'observer_type',
];
public function getLedgers() {
return $this->hasMany('App\Models\MiningTax\Ledger', 'observer_id', 'observer_id');
}
];
}

View File

@@ -9,6 +9,9 @@ class Payment extends Model
//Table Name
protected $table = 'alliance_mining_tax_payments';
//Primary Key
public $primaryKey = 'id';
//Timestamps
public $timestamps = true;
@@ -28,6 +31,6 @@ class Payment extends Model
];
public function getInvoice() {
return $this->belongsTo('App\Models\MiningTax\Invoice', 'invoice_id', 'invoice_id');
return $this->belongsTo(App\Models\MiningTax\Invoice::class, 'invoice_id', 'invoice_id');
}
}

View File

@@ -9,6 +9,9 @@ class Config extends Model
// Table Name
protected $table = 'Config';
//Primary Key
public $primaryKey = 'id';
// Timestamps
public $timestamps = false;

View File

@@ -9,6 +9,9 @@ class ItemComposition extends Model
// Table Name
protected $table = 'ItemComposition';
//Primary Key
public $primaryKey = 'id';
// Timestamps
public $timestamps = false;
}

View File

@@ -14,4 +14,14 @@ class SrpFleetType extends Model
//Timestamps
public $timestamps = false;
/**
* The attributes that are mass assignable
*
* @var array
*/
protected $fillable = [
'code',
'description',
];
}

View File

@@ -22,6 +22,6 @@ class SrpPayout extends Model
];
public function shipType() {
return $this->belongsTo(SrpShipType::class);
return $this->belongsTo(SrpShipType::class, 'code', 'code');
}
}

View File

@@ -22,6 +22,10 @@ class SrpShipType extends Model
];
public function costCode() {
return $this->hasOne('App\Models\SRP\SrpPayout', 'code', 'code');
return $this->hasOne(App\Models\SRP\SrpPayout::class, 'code', 'code');
}
public function fleetType() {
return $this->belongsTo(App\Models\SRP\SrpFleetType::class, 'code', 'code');
}
}

View File

@@ -6,10 +6,13 @@ use Illuminate\Database\Eloquent\Model;
class ScheduleJob extends Model
{
//Table Name
protected $table = 'schedule_jobs';
//Timestamps
public $timestamps = true;
//Primary Key
public $primaryKey = 'id';
protected $fillable = [

View File

@@ -36,4 +36,8 @@ class Asset extends Model
'type_id',
'updated_at',
];
public function structure() {
return $this->belongsTo(App\Models\Structure\Structure::class, 'structure_id', 'location_id');
}
}

View File

@@ -27,6 +27,6 @@ class Service extends Model
];
public function structure() {
return $this->hasOne('App\Models\Structure\Structure', 'structure_id', 'structure_id');
return $this->belongsTo(App\Models\Structure\Structure::class, 'structure_id', 'structure_id');
}
}

View File

@@ -50,6 +50,10 @@ class Structure extends Model
];
public function services() {
return $this->hasMany('App\Models\Structure\Service', 'structure_id', 'structure_id');
return $this->hasMany(App\Models\Structure\Service::class, 'structure_id', 'structure_id');
}
public function assets() {
return $this->hasMany(App\Models\Structure\Asset::class, 'location_id', 'structure_id');
}
}

View File

@@ -11,6 +11,9 @@ class AvailableUserPermission extends Model
*/
protected $table = 'available_user_permissions';
//Primary Key
public $primaryKey = 'id';
/**
* Timestamps enabled for the rows
*/

View File

@@ -9,6 +9,9 @@ class AvailableUserRole extends Model
//Table Name
protected $table = 'available_user_roles';
//Primary Key
public $primaryKey = 'id';
//Timestamps
public $timestamps = false;

View File

@@ -22,6 +22,9 @@ class User extends Authenticatable
*/
protected $table = 'users';
//Primary Key
public $primaryKey = 'id';
/**
* The attributes that are mass assignable.
*

View File

@@ -9,6 +9,10 @@ class UserAlt extends Model
//Table Name
public $table = 'user_alts';
//Primary Key
public $primaryKey = 'id';
//Timestamps
public $timestamps = false;
/**

View File

@@ -11,6 +11,9 @@ class UserPermission extends Model
*/
protected $table = 'user_permissions';
//Primary Key
public $primaryKey = 'id';
/**
* The attributes that are mass assignable
*

View File

@@ -11,6 +11,14 @@ class UserRole extends Model
*/
protected $table = 'user_roles';
//Primary Key
public $primaryKey = 'id';
/**
* Attributes which are mass assignable
*
* @var array
*/
protected $fillable = [
'character_id',
'role',