From 757f3220b4792d931d82e5a52e25d9f3e5e928d2 Mon Sep 17 00:00:00 2001 From: Dedan Date: Thu, 5 Sep 2024 18:48:40 +0300 Subject: [PATCH] Changes to files: app/Filament/AccountPlugin.php app/Filament/Resources/GatewayAllowedinResource.php app/Filament/Resources/GatewayDisallowedinResource.php app/Filament/Resources/GatewayRateResource.php app/Filament/Resources/GatewayResource.php app/Filament/Resources/InvoiceCouponResource.php app/Filament/Resources/InvoiceItemRateResource.php app/Filament/Resources/InvoiceItemResource.php app/Filament/Resources/InvoiceStatusResource.php app/Filament/Resources/LedgerCategoryResource.php app/Filament/Resources/PaymentRateResource.php app/Filament/Resources/RateAllowedinResource.php app/Filament/Resources/RateDisallowedinResource.php app/Filament/Resources/RateFileResource.php app/Models/Gateway.php app/Models/GatewayAllowedin.php app/Models/GatewayDisallowedin.php app/Models/GatewayRate.php app/Models/Invoice.php app/Models/InvoiceCoupon.php app/Models/InvoiceItem.php app/Models/InvoiceItemRate.php app/Models/Journal.php app/Models/Ledger.php app/Models/LedgerCategory.php app/Models/OpeningBalance.php app/Models/Payment.php app/Models/PaymentRate.php app/Models/Rate.php app/Models/RateAllowedin.php app/Models/RateDisallowedin.php app/Models/RateFile.php app/Models/Transaction.php --- app/Filament/AccountPlugin.php | 10 ---- .../Resources/GatewayAllowedinResource.php | 2 + .../Resources/GatewayDisallowedinResource.php | 2 + .../Resources/GatewayRateResource.php | 2 + app/Filament/Resources/GatewayResource.php | 1 + .../Resources/InvoiceCouponResource.php | 2 + .../Resources/InvoiceItemRateResource.php | 2 + .../Resources/InvoiceItemResource.php | 5 ++ .../Resources/InvoiceStatusResource.php | 2 + .../Resources/LedgerCategoryResource.php | 2 + .../Resources/PaymentRateResource.php | 2 + .../Resources/RateAllowedinResource.php | 2 + .../Resources/RateDisallowedinResource.php | 2 + app/Filament/Resources/RateFileResource.php | 1 + app/Models/Gateway.php | 23 ++++++++ app/Models/GatewayAllowedin.php | 21 +++++++ app/Models/GatewayDisallowedin.php | 20 +++++++ app/Models/GatewayRate.php | 20 +++++++ app/Models/Invoice.php | 10 ++++ app/Models/InvoiceCoupon.php | 20 +++++++ app/Models/InvoiceItem.php | 21 +++++++ app/Models/InvoiceItemRate.php | 20 +++++++ app/Models/Journal.php | 41 +++++++++++++ app/Models/Ledger.php | 20 +++++++ app/Models/LedgerCategory.php | 34 +++++++++++ app/Models/OpeningBalance.php | 30 ++++++++++ app/Models/Payment.php | 30 ++++++++++ app/Models/PaymentRate.php | 21 +++++++ app/Models/Rate.php | 11 ++++ app/Models/RateAllowedin.php | 20 +++++++ app/Models/RateDisallowedin.php | 21 +++++++ app/Models/RateFile.php | 10 ++++ app/Models/Transaction.php | 59 +++++++++++++++++++ 33 files changed, 479 insertions(+), 10 deletions(-) diff --git a/app/Filament/AccountPlugin.php b/app/Filament/AccountPlugin.php index 78bb7b3..d6f77a1 100644 --- a/app/Filament/AccountPlugin.php +++ b/app/Filament/AccountPlugin.php @@ -5,7 +5,6 @@ use Coolsam\Modules\Concerns\ModuleFilamentPlugin; use Filament\Contracts\Plugin; use Filament\Facades\Filament; -use Filament\Navigation\NavigationItem; use Filament\Panel; use Modules\Account\Filament\Pages\AccountDashboard; @@ -30,14 +29,5 @@ public function boot(Panel $panel): void AccountDashboard::class, ]); - // Add "Account" to the top navigation - $panel->navigationItems([ - NavigationItem::make() - ->label('Account') - ->url(AccountDashboard::getUrl()) - ->icon('heroicon-o-squares-2x2') - ->sort(-1), // Adjust the order as needed - ]); - } } diff --git a/app/Filament/Resources/GatewayAllowedinResource.php b/app/Filament/Resources/GatewayAllowedinResource.php index 9652099..717fd23 100644 --- a/app/Filament/Resources/GatewayAllowedinResource.php +++ b/app/Filament/Resources/GatewayAllowedinResource.php @@ -18,6 +18,8 @@ class GatewayAllowedinResource extends Resource protected static ?string $slug = 'account/gateway/allowedin'; + protected static ?string $navigationGroup = 'Account'; + protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; protected static ?string $navigationParentItem = 'Gateway'; diff --git a/app/Filament/Resources/GatewayDisallowedinResource.php b/app/Filament/Resources/GatewayDisallowedinResource.php index 9f94064..d0edac8 100644 --- a/app/Filament/Resources/GatewayDisallowedinResource.php +++ b/app/Filament/Resources/GatewayDisallowedinResource.php @@ -20,6 +20,8 @@ class GatewayDisallowedinResource extends Resource protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; + protected static ?string $navigationGroup = 'Account'; + protected static ?string $navigationParentItem = 'Gateway'; public static function form(Form $form): Form diff --git a/app/Filament/Resources/GatewayRateResource.php b/app/Filament/Resources/GatewayRateResource.php index 450eff7..a8f2372 100644 --- a/app/Filament/Resources/GatewayRateResource.php +++ b/app/Filament/Resources/GatewayRateResource.php @@ -18,6 +18,8 @@ class GatewayRateResource extends Resource protected static ?string $slug = 'account/gateway/rate'; + protected static ?string $navigationGroup = 'Account'; + protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; protected static ?string $navigationParentItem = 'Gateway'; diff --git a/app/Filament/Resources/GatewayResource.php b/app/Filament/Resources/GatewayResource.php index aa66c92..39bb821 100644 --- a/app/Filament/Resources/GatewayResource.php +++ b/app/Filament/Resources/GatewayResource.php @@ -21,6 +21,7 @@ class GatewayResource extends Resource protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; protected static ?string $navigationGroup = 'Account'; + protected static ?string $navigationLabel = 'Gateway'; protected static ?int $navigationSort = 1; diff --git a/app/Filament/Resources/InvoiceCouponResource.php b/app/Filament/Resources/InvoiceCouponResource.php index f489c5a..2dcf3e7 100644 --- a/app/Filament/Resources/InvoiceCouponResource.php +++ b/app/Filament/Resources/InvoiceCouponResource.php @@ -18,6 +18,8 @@ class InvoiceCouponResource extends Resource protected static ?string $slug = 'account/invoice/coupon'; + protected static ?string $navigationGroup = 'Account'; + protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; public static function form(Form $form): Form diff --git a/app/Filament/Resources/InvoiceItemRateResource.php b/app/Filament/Resources/InvoiceItemRateResource.php index 9d405ea..499076f 100644 --- a/app/Filament/Resources/InvoiceItemRateResource.php +++ b/app/Filament/Resources/InvoiceItemRateResource.php @@ -18,6 +18,8 @@ class InvoiceItemRateResource extends Resource protected static ?string $slug = 'account/invoice/item/rate'; + protected static ?string $navigationGroup = 'Account'; + protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; public static function form(Form $form): Form diff --git a/app/Filament/Resources/InvoiceItemResource.php b/app/Filament/Resources/InvoiceItemResource.php index 932f72b..3854715 100644 --- a/app/Filament/Resources/InvoiceItemResource.php +++ b/app/Filament/Resources/InvoiceItemResource.php @@ -18,6 +18,8 @@ class InvoiceItemResource extends Resource protected static ?string $slug = 'account/invoice/item'; + protected static ?string $navigationGroup = 'Account'; + protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; public static function form(Form $form): Form @@ -30,6 +32,9 @@ public static function form(Form $form): Form Forms\Components\TextInput::make('invoice_id') ->required() ->numeric(), + \Codedor\FilamentResourcePicker\Filament\Forms\Components\ResourcePickerInput::make('invoice_id') + ->resource(InvoiceResource::class) + ->required(), Forms\Components\TextInput::make('ledger_id') ->required() ->numeric(), diff --git a/app/Filament/Resources/InvoiceStatusResource.php b/app/Filament/Resources/InvoiceStatusResource.php index 1b83f6b..c933fc1 100644 --- a/app/Filament/Resources/InvoiceStatusResource.php +++ b/app/Filament/Resources/InvoiceStatusResource.php @@ -17,6 +17,8 @@ class InvoiceStatusResource extends Resource protected static ?string $slug = 'account/invoice/status'; + protected static ?string $navigationGroup = 'Account'; + protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; public static function form(Form $form): Form diff --git a/app/Filament/Resources/LedgerCategoryResource.php b/app/Filament/Resources/LedgerCategoryResource.php index b42ba14..90109b6 100644 --- a/app/Filament/Resources/LedgerCategoryResource.php +++ b/app/Filament/Resources/LedgerCategoryResource.php @@ -18,6 +18,8 @@ class LedgerCategoryResource extends Resource protected static ?string $slug = 'account/ledger/category'; + protected static ?string $navigationGroup = 'Account'; + protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; public static function form(Form $form): Form diff --git a/app/Filament/Resources/PaymentRateResource.php b/app/Filament/Resources/PaymentRateResource.php index 40db43b..2c220e8 100644 --- a/app/Filament/Resources/PaymentRateResource.php +++ b/app/Filament/Resources/PaymentRateResource.php @@ -18,6 +18,8 @@ class PaymentRateResource extends Resource protected static ?string $slug = 'account/payment/rate'; + protected static ?string $navigationGroup = 'Account'; + protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; public static function form(Form $form): Form diff --git a/app/Filament/Resources/RateAllowedinResource.php b/app/Filament/Resources/RateAllowedinResource.php index 492c55f..60307a1 100644 --- a/app/Filament/Resources/RateAllowedinResource.php +++ b/app/Filament/Resources/RateAllowedinResource.php @@ -20,6 +20,8 @@ class RateAllowedinResource extends Resource protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; + protected static ?string $navigationGroup = 'Account'; + protected static ?string $navigationLabel = 'Rate Allowed In'; protected static ?string $navigationParentItem = 'Rate'; diff --git a/app/Filament/Resources/RateDisallowedinResource.php b/app/Filament/Resources/RateDisallowedinResource.php index dcb5ae5..a06701c 100644 --- a/app/Filament/Resources/RateDisallowedinResource.php +++ b/app/Filament/Resources/RateDisallowedinResource.php @@ -20,6 +20,8 @@ class RateDisallowedinResource extends Resource protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; + protected static ?string $navigationGroup = 'Account'; + protected static ?string $navigationLabel = 'Rate Disallowed In'; protected static ?string $navigationParentItem = 'Rate'; diff --git a/app/Filament/Resources/RateFileResource.php b/app/Filament/Resources/RateFileResource.php index b84d8a2..77e6c1f 100644 --- a/app/Filament/Resources/RateFileResource.php +++ b/app/Filament/Resources/RateFileResource.php @@ -20,6 +20,7 @@ class RateFileResource extends Resource protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; + protected static ?string $navigationGroup = 'Account'; protected static ?string $navigationLabel = 'Rate File'; protected static ?string $navigationParentItem = 'Rate'; diff --git a/app/Models/Gateway.php b/app/Models/Gateway.php index 641388b..075a9a7 100755 --- a/app/Models/Gateway.php +++ b/app/Models/Gateway.php @@ -2,7 +2,9 @@ namespace Modules\Account\Models; +use Modules\Account\Models\Ledger; use Modules\Base\Models\BaseModel; +use Modules\Core\Models\Currency; class Gateway extends BaseModel { @@ -31,4 +33,25 @@ class Gateway extends BaseModel * @var bool */ protected bool $can_delete = false; + + /** + * Add relationship to Ledger + * + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function ledger() + { + return $this->belongsTo(Ledger::class); + } + + /** + * Add relationship to Currency + * + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function currency() + { + return $this->belongsTo(Currency::class); + } + } diff --git a/app/Models/GatewayAllowedin.php b/app/Models/GatewayAllowedin.php index 437c455..728968d 100755 --- a/app/Models/GatewayAllowedin.php +++ b/app/Models/GatewayAllowedin.php @@ -2,7 +2,9 @@ namespace Modules\Account\Models; +use Modules\Account\Models\Gateway; use Modules\Base\Models\BaseModel; +use Modules\Core\Models\Country; class GatewayAllowedin extends BaseModel { @@ -20,4 +22,23 @@ class GatewayAllowedin extends BaseModel * @var string */ protected $table = "account_gateway_allowedin"; + + /** + * Add relationship to Gateway + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function gateway() + { + return $this->belongsTo(Gateway::class); + } + + /** + * Add relationship to Country + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + + public function country() + { + return $this->belongsTo(Country::class); + } } diff --git a/app/Models/GatewayDisallowedin.php b/app/Models/GatewayDisallowedin.php index 42bd324..e6e0c6c 100755 --- a/app/Models/GatewayDisallowedin.php +++ b/app/Models/GatewayDisallowedin.php @@ -2,7 +2,9 @@ namespace Modules\Account\Models; +use Modules\Account\Models\Gateway; use Modules\Base\Models\BaseModel; +use Modules\Core\Models\Country; class GatewayDisallowedin extends BaseModel { @@ -20,4 +22,22 @@ class GatewayDisallowedin extends BaseModel * @var string */ protected $table = "account_gateway_disallowedin"; + + /** + * Add relationship to Gateway + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function gateway() + { + return $this->belongsTo(Gateway::class); + } + + /** + * Add relationship to Country + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function country() + { + return $this->belongsTo(Country::class); + } } diff --git a/app/Models/GatewayRate.php b/app/Models/GatewayRate.php index 8698ada..5e5c06b 100755 --- a/app/Models/GatewayRate.php +++ b/app/Models/GatewayRate.php @@ -2,6 +2,8 @@ namespace Modules\Account\Models; +use Modules\Account\Models\Gateway; +use Modules\Account\Models\Rate; use Modules\Base\Models\BaseModel; class GatewayRate extends BaseModel @@ -20,4 +22,22 @@ class GatewayRate extends BaseModel * @var string */ protected $table = "account_gateway_rate"; + + /** + * Add relationship to Gateway + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function gateway() + { + return $this->belongsTo(Gateway::class); + } + + /** + * Add relationship to Rate + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function rate() + { + return $this->belongsTo(Rate::class); + } } diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index c2cfc87..4bd96a3 100755 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -3,6 +3,7 @@ namespace Modules\Account\Models; use Modules\Base\Models\BaseModel; +use Modules\Partner\Models\Partner; class Invoice extends BaseModel { @@ -23,4 +24,13 @@ class Invoice extends BaseModel * @var string */ protected $table = "account_invoice"; + + /** + * Add relationship to Partner + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function partner() + { + return $this->belongsTo(Partner::class); + } } diff --git a/app/Models/InvoiceCoupon.php b/app/Models/InvoiceCoupon.php index a42d2b6..f008c90 100755 --- a/app/Models/InvoiceCoupon.php +++ b/app/Models/InvoiceCoupon.php @@ -2,6 +2,8 @@ namespace Modules\Account\Models; +use Modules\Account\Models\Coupon; +use Modules\Account\Models\Invoice; use Modules\Base\Models\BaseModel; class InvoiceCoupon extends BaseModel @@ -20,4 +22,22 @@ class InvoiceCoupon extends BaseModel * @var string */ protected $table = "account_invoice_coupon"; + + /** + * Add relationship to Invoice + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function invoice() + { + return $this->belongsTo(Invoice::class); + } + + /** + * Add relationship to Coupon + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function coupon() + { + return $this->belongsTo(Coupon::class); + } } diff --git a/app/Models/InvoiceItem.php b/app/Models/InvoiceItem.php index cfce0e5..4e4353e 100755 --- a/app/Models/InvoiceItem.php +++ b/app/Models/InvoiceItem.php @@ -2,6 +2,8 @@ namespace Modules\Account\Models; +use Modules\Account\Models\Invoice; +use Modules\Account\Models\Ledger; use Modules\Base\Models\BaseModel; class InvoiceItem extends BaseModel @@ -23,4 +25,23 @@ class InvoiceItem extends BaseModel * @var string */ protected $table = "account_invoice_item"; + + /** + * Add relationship to Invoice + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function invoice() + { + return $this->belongsTo(Invoice::class); + } + + /** + * Add relationship to Ledger + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function ledger() + { + return $this->belongsTo(Ledger::class); + } + } diff --git a/app/Models/InvoiceItemRate.php b/app/Models/InvoiceItemRate.php index d08f305..5ded5d4 100755 --- a/app/Models/InvoiceItemRate.php +++ b/app/Models/InvoiceItemRate.php @@ -2,6 +2,8 @@ namespace Modules\Account\Models; +use Modules\Account\Models\InvoiceItem; +use Modules\Account\Models\Rate; use Modules\Base\Models\BaseModel; class InvoiceItemRate extends BaseModel @@ -22,4 +24,22 @@ class InvoiceItemRate extends BaseModel * @var string */ protected $table = "account_invoice_item_rate"; + + /** + * Add relationship to InvoiceItem + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function invoiceItem() + { + return $this->belongsTo(InvoiceItem::class); + } + + /** + * Add relationship to Rate + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function rate() + { + return $this->belongsTo(Rate::class); + } } diff --git a/app/Models/Journal.php b/app/Models/Journal.php index ad6565a..ad4c368 100755 --- a/app/Models/Journal.php +++ b/app/Models/Journal.php @@ -2,7 +2,11 @@ namespace Modules\Account\Models; +use Modules\Account\Models\Invoice; +use Modules\Account\Models\Ledger; +use Modules\Account\Models\Payment; use Modules\Base\Models\BaseModel; +use Modules\Partner\Models\Partner; class Journal extends BaseModel { @@ -27,4 +31,41 @@ class Journal extends BaseModel * @var bool */ protected bool $can_delete = false; + + /** + * Add relationship to Partner + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function partner() + { + return $this->belongsTo(Partner::class); + } + + /** + * Add relationship to Ledger + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function ledger() + { + return $this->belongsTo(Ledger::class); + } + + /** + * Add relationship to Payment + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function payment() + { + return $this->belongsTo(Payment::class); + } + + /** + * Add relationship to Invoice + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function invoice() + { + return $this->belongsTo(Invoice::class); + } + } diff --git a/app/Models/Ledger.php b/app/Models/Ledger.php index bd074eb..ad3c02c 100755 --- a/app/Models/Ledger.php +++ b/app/Models/Ledger.php @@ -2,6 +2,8 @@ namespace Modules\Account\Models; +use Modules\Account\Models\ChartOfAccount; +use Modules\Account\Models\LedgerCategory; use Modules\Base\Models\BaseModel; class Ledger extends BaseModel @@ -28,6 +30,24 @@ class Ledger extends BaseModel */ protected bool $can_delete = false; + /** + * Add relationship to Chart + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function chart() + { + return $this->belongsTo(ChartOfAccount::class); + } + + /** + * Add relationship to Category + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function category() + { + return $this->belongsTo(LedgerCategory::class); + } + /** * Function for deleting a record. * diff --git a/app/Models/LedgerCategory.php b/app/Models/LedgerCategory.php index 611b807..b61aac3 100755 --- a/app/Models/LedgerCategory.php +++ b/app/Models/LedgerCategory.php @@ -2,6 +2,9 @@ namespace Modules\Account\Models; +use Modules\Account\Models\ChartOfAccount; +use Modules\Account\Models\Ledger; +use Modules\Account\Models\LedgerCategory; use Modules\Base\Models\BaseModel; class LedgerCategory extends BaseModel @@ -20,4 +23,35 @@ class LedgerCategory extends BaseModel * @var string */ protected $table = "account_ledger_category"; + + /** + * Add relationship to Ledger + * @return \Illuminate\Database\Eloquent\Relations\HasMany + */ + + public function ledgers() + { + return $this->hasMany(Ledger::class); + } + + /** + * Add relationship to ChartOfAccount + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + + public function chart() + { + return $this->belongsTo(ChartOfAccount::class); + } + + /** + * Add relationship to Parent + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + + public function parent() + { + return $this->belongsTo(LedgerCategory::class, 'parent_id'); + } + } diff --git a/app/Models/OpeningBalance.php b/app/Models/OpeningBalance.php index 8e73676..7b4823d 100755 --- a/app/Models/OpeningBalance.php +++ b/app/Models/OpeningBalance.php @@ -2,6 +2,9 @@ namespace Modules\Account\Models; +use Modules\Account\Models\ChartOfAccount; +use Modules\Account\Models\FinancialYear; +use Modules\Account\Models\Ledger; use Modules\Base\Models\BaseModel; class OpeningBalance extends BaseModel @@ -20,4 +23,31 @@ class OpeningBalance extends BaseModel * @var string */ protected $table = "account_opening_balance"; + + /** + * Add relationship to Ledger + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function ledger() + { + return $this->belongsTo(Ledger::class); + } + + /** + * Add relationship to ChartOfAccount + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function chart() + { + return $this->belongsTo(ChartOfAccount::class); + } + + /** + * Add relationship to FinancialYear + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function financialYear() + { + return $this->belongsTo(FinancialYear::class); + } } diff --git a/app/Models/Payment.php b/app/Models/Payment.php index 77e8e77..c5fe60f 100755 --- a/app/Models/Payment.php +++ b/app/Models/Payment.php @@ -2,7 +2,10 @@ namespace Modules\Account\Models; +use Modules\Account\Models\Gateway; +use Modules\Account\Models\Ledger; use Modules\Base\Models\BaseModel; +use Modules\Partner\Models\Partner; class Payment extends BaseModel { @@ -37,4 +40,31 @@ class Payment extends BaseModel * @var bool */ public bool $show_frontend = true; + + /** + * Add relationship to Ledger + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function ledger() + { + return $this->belongsTo(Ledger::class); + } + + /** + * Add relationship to Partner + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function partner() + { + return $this->belongsTo(Partner::class); + } + + /** + * Add relationship to Gateway + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function gateway() + { + return $this->belongsTo(Gateway::class); + } } diff --git a/app/Models/PaymentRate.php b/app/Models/PaymentRate.php index df9be14..4fa4ac7 100755 --- a/app/Models/PaymentRate.php +++ b/app/Models/PaymentRate.php @@ -2,6 +2,8 @@ namespace Modules\Account\Models; +use Modules\Account\Models\Payment; +use Modules\Account\Models\Rate; use Modules\Base\Models\BaseModel; class PaymentRate extends BaseModel @@ -20,4 +22,23 @@ class PaymentRate extends BaseModel * @var string */ protected $table = "account_payment_rate"; + + /** + * Add relationship to Payment + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function payment() + { + return $this->belongsTo(Payment::class); + } + + /** + * Add relationship to Rate + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function rate() + { + return $this->belongsTo(Rate::class); + } + } diff --git a/app/Models/Rate.php b/app/Models/Rate.php index b585945..fa5a221 100755 --- a/app/Models/Rate.php +++ b/app/Models/Rate.php @@ -2,6 +2,7 @@ namespace Modules\Account\Models; +use Modules\Account\Models\Ledger; use Modules\Base\Models\BaseModel; class Rate extends BaseModel @@ -24,4 +25,14 @@ class Rate extends BaseModel * @var string */ protected $table = "account_rate"; + + /** + * Add relationship to Ledger + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function ledger() + { + return $this->belongsTo(Ledger::class); + } + } diff --git a/app/Models/RateAllowedin.php b/app/Models/RateAllowedin.php index 7bc4ee0..1e955b4 100755 --- a/app/Models/RateAllowedin.php +++ b/app/Models/RateAllowedin.php @@ -2,7 +2,9 @@ namespace Modules\Account\Models; +use Modules\Account\Models\Rate; use Modules\Base\Models\BaseModel; +use Modules\Core\Models\Country; class RateAllowedin extends BaseModel { @@ -20,4 +22,22 @@ class RateAllowedin extends BaseModel * @var string */ protected $table = "account_rate_allowedin"; + + /** + * Add relationship to Rate + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function rate() + { + return $this->belongsTo(Rate::class); + } + + /** + * Add relationship to Country + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function country() + { + return $this->belongsTo(Country::class); + } } diff --git a/app/Models/RateDisallowedin.php b/app/Models/RateDisallowedin.php index e454199..8d18eeb 100755 --- a/app/Models/RateDisallowedin.php +++ b/app/Models/RateDisallowedin.php @@ -2,7 +2,9 @@ namespace Modules\Account\Models; +use Modules\Account\Models\Rate; use Modules\Base\Models\BaseModel; +use Modules\Core\Models\Country; class RateDisallowedin extends BaseModel { @@ -20,4 +22,23 @@ class RateDisallowedin extends BaseModel * @var string */ protected $table = "account_rate_disallowedin"; + + /** + * Add relationship to Rate + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function rate() + { + return $this->belongsTo(Rate::class); + } + + /** + * Add relationship to Country + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function country() + { + return $this->belongsTo(Country::class); + } + } diff --git a/app/Models/RateFile.php b/app/Models/RateFile.php index 32058d8..c6eddeb 100755 --- a/app/Models/RateFile.php +++ b/app/Models/RateFile.php @@ -2,6 +2,7 @@ namespace Modules\Account\Models; +use Modules\Account\Models\Rate; use Modules\Base\Models\BaseModel; class RateFile extends BaseModel @@ -22,4 +23,13 @@ class RateFile extends BaseModel * @var string */ protected $table = "account_rate_file"; + + /** + * Add relationship to Rate + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function rate() + { + return $this->belongsTo(Rate::class); + } } diff --git a/app/Models/Transaction.php b/app/Models/Transaction.php index 84df49d..ec95d87 100755 --- a/app/Models/Transaction.php +++ b/app/Models/Transaction.php @@ -2,7 +2,11 @@ namespace Modules\Account\Models; +use Modules\Account\Models\ChartOfAccount; +use Modules\Account\Models\Ledger; +use Modules\Account\Models\LedgerSetting; use Modules\Base\Models\BaseModel; +use Modules\Partner\Models\Partner; class Transaction extends BaseModel { @@ -30,4 +34,59 @@ class Transaction extends BaseModel * @var bool */ protected bool $can_delete = false; + + /** + * Add Relationship to Partner + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function partner() + { + return $this->belongsTo(Partner::class); + } + + /** + * Add Relationship to LedgerSetting + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function ledgerSetting() + { + return $this->belongsTo(LedgerSetting::class); + } + + /** + * Add Relationship to ChartOfAccount + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function leftChartOfAccount() + { + return $this->belongsTo(ChartOfAccount::class, 'left_chart_of_account_id'); + } + + /** + * Add Relationship to Ledger + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function leftLedger() + { + return $this->belongsTo(Ledger::class, 'left_ledger_id'); + } + + /** + * Add Relationship to ChartOfAccount + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function rightChartOfAccount() + { + return $this->belongsTo(ChartOfAccount::class, 'right_chart_of_account_id'); + } + + /** + * Add Relationship to Ledger + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function rightLedger() + { + return $this->belongsTo(Ledger::class, 'right_ledger_id'); + } + }