Finance overview page added to admin with monthly breakdown #130
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Enums\JournalType;
|
||||
use App\Models\Traits\JournalTrait;
|
||||
|
||||
/**
|
||||
@@ -15,6 +16,11 @@ class Airline extends BaseModel
|
||||
|
||||
public $table = 'airlines';
|
||||
|
||||
/**
|
||||
* The journal type for the callback
|
||||
*/
|
||||
public $journal_type = JournalType::AIRLINE;
|
||||
|
||||
public $fillable = [
|
||||
'icao',
|
||||
'iata',
|
||||
|
||||
13
app/Models/Enums/JournalType.php
Normal file
13
app/Models/Enums/JournalType.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Enums;
|
||||
|
||||
/**
|
||||
* Class AcarsType
|
||||
* @package App\Models\Enums
|
||||
*/
|
||||
class JournalType extends EnumBase
|
||||
{
|
||||
public const AIRLINE = 0;
|
||||
public const USER = 1;
|
||||
}
|
||||
@@ -12,20 +12,26 @@ use Carbon\Carbon;
|
||||
/**
|
||||
* Class Journal
|
||||
* @package Scottlaurent\Accounting
|
||||
* @property Money $balance
|
||||
* @property string $currency
|
||||
* @property Carbon $updated_at
|
||||
* @property Carbon $post_date
|
||||
* @property Carbon $created_at
|
||||
* @property Money $balance
|
||||
* @property string $currency
|
||||
* @property Carbon $updated_at
|
||||
* @property Carbon $post_date
|
||||
* @property Carbon $created_at
|
||||
* @property \App\Models\Enums\JournalType type
|
||||
*/
|
||||
class Journal extends BaseModel
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'journals';
|
||||
|
||||
public $fillable = [
|
||||
'ledger_id',
|
||||
'journal_type',
|
||||
'balance',
|
||||
'currency',
|
||||
'morphed_type',
|
||||
'morphed_id',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
|
||||
@@ -14,6 +14,7 @@ class SubfleetExpense extends BaseModel
|
||||
'subfleet_id',
|
||||
'name',
|
||||
'amount',
|
||||
'type',
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -23,6 +24,7 @@ class SubfleetExpense extends BaseModel
|
||||
*/
|
||||
protected $casts = [
|
||||
'amount' => 'float',
|
||||
'type' => 'integer',
|
||||
];
|
||||
|
||||
public static $rules = [
|
||||
|
||||
@@ -38,6 +38,7 @@ trait JournalTrait
|
||||
{
|
||||
if (!$this->journal) {
|
||||
$journal = new Journal();
|
||||
$journal->type = $this->journal_type;
|
||||
$journal->currency = $currency_code;
|
||||
$journal->balance = 0;
|
||||
$this->journal()->save($journal);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Enums\JournalType;
|
||||
use App\Models\Enums\PirepState;
|
||||
use App\Models\Traits\JournalTrait;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
@@ -32,6 +33,11 @@ class User extends Authenticatable
|
||||
|
||||
public $table = 'users';
|
||||
|
||||
/**
|
||||
* The journal type for when it's being created
|
||||
*/
|
||||
public $journal_type = JournalType::USER;
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'email',
|
||||
|
||||
Reference in New Issue
Block a user