diff --git a/Entities/BillingCycle.php b/Entities/BillingCycle.php index fd8c105..c447d33 100755 --- a/Entities/BillingCycle.php +++ b/Entities/BillingCycle.php @@ -3,8 +3,6 @@ namespace Modules\Isp\Entities; use Illuminate\Database\Schema\Blueprint; -use Modules\Base\Classes\Views\FormBuilder; -use Modules\Base\Classes\Views\ListTable; use Modules\Base\Entities\BaseModel; class BillingCycle extends BaseModel @@ -37,79 +35,20 @@ class BillingCycle extends BaseModel */ protected $table = "isp_billing_cycle"; - /** - * Function for defining list of fields in table view. - * - * @return ListTable - */ - public function listTable(): ListTable - { - // listing view fields - $fields = new ListTable(); - - $fields->name('title')->type('text')->ordering(true); - $fields->name('slug')->type('text')->ordering(true); - $fields->name('duration')->type('text')->ordering(true); - $fields->name('duration_type')->type('text')->ordering(true); - $fields->name('published')->type('switch')->ordering(true); - - return $fields; - - } - - /** - * Function for defining list of fields in form view. - * - * @return FormBuilder - */ - public function formBuilder(): FormBuilder - { - // listing view fields - $fields = new FormBuilder(); - - $fields->name('title')->type('text')->group('w-1/2'); - $fields->name('slug')->type('text')->group('w-1/2'); - $fields->name('duration')->type('text')->group('w-1/2'); - $fields->name('duration_type')->type('text')->group('w-1/2'); - $fields->name('published')->type('switch')->group('w-1/2'); - $fields->name('description')->type('textarea')->group('w-full'); - - return $fields; - - } - - /** - * Function for defining list of fields in filter view. - * - * @return FormBuilder - */ - public function filter(): FormBuilder - { - // listing view fields - $fields = new FormBuilder(); - - $fields->name('title')->type('text')->group('w-1/6'); - $fields->name('slug')->type('text')->group('w-1/6'); - $fields->name('duration')->type('text')->group('w-1/6'); - $fields->name('duration_type')->type('text')->group('w-1/6'); - - return $fields; - - } /** * List of fields to be migrated to the datebase when creating or updating model during migration. * * @param Blueprint $table * @return void */ - public function migration(Blueprint $table): void + public function fields(Blueprint $table): void { - $table->increments('id'); - $table->string('title'); - $table->string('slug'); - $table->string('description')->nullable(); - $table->string('duration')->nullable(); - $table->enum('duration_type', ['minute', 'hour', 'day', 'week', 'month', 'year'])->default('month')->nullable(); - $table->boolean('published')->default(true)->nullable(); + $this->fields->increments('id')->html('text'); + $this->fields->string('title')->html('text'); + $this->fields->string('slug')->html('text'); + $this->fields->string('description')->nullable()->html('textarea'); + $this->fields->string('duration')->nullable()->html('number'); + $this->fields->enum('duration_type', ['minute', 'hour', 'day', 'week', 'month', 'year'])->default('month')->nullable()->html('switch'); + $this->fields->boolean('published')->default(true)->nullable()->html('switch'); } } diff --git a/Entities/Gateway.php b/Entities/Gateway.php index 655a702..e3ff8f6 100755 --- a/Entities/Gateway.php +++ b/Entities/Gateway.php @@ -3,8 +3,6 @@ namespace Modules\Isp\Entities; use Illuminate\Database\Schema\Blueprint; -use Modules\Base\Classes\Views\FormBuilder; -use Modules\Base\Classes\Views\ListTable; use Modules\Base\Entities\BaseModel; class Gateway extends BaseModel @@ -37,86 +35,23 @@ class Gateway extends BaseModel */ protected $table = "isp_gateway"; - /** - * Function for defining list of fields in table view. - * - * @return ListTable - */ - public function listTable(): ListTable - { - // listing view fields - $fields = new ListTable(); - - $fields->name('title')->type('text')->ordering(true); - $fields->name('username')->type('text')->ordering(true); - $fields->name('database')->type('text')->ordering(true); - $fields->name('ip_address')->type('text')->ordering(true); - $fields->name('port')->type('text')->ordering(true); - $fields->name('type')->type('text')->ordering(true); - $fields->name('published')->type('switch')->ordering(true); - - return $fields; - - } - - /** - * Function for defining list of fields in form view. - * - * @return FormBuilder - */ - public function formBuilder(): FormBuilder - { - // listing view fields - $fields = new FormBuilder(); - - $fields->name('title')->type('text')->group('w-1/2'); - $fields->name('username')->type('text')->group('w-1/2'); - $fields->name('password')->type('text')->group('w-1/2'); - $fields->name('database')->type('text')->group('w-1/2'); - $fields->name('ip_address')->type('text')->group('w-1/2'); - $fields->name('port')->type('text')->group('w-1/2'); - $fields->name('type')->type('text')->group('w-1/2'); - $fields->name('published')->type('switch')->group('w-1/2'); - - return $fields; - - } - - /** - * Function for defining list of fields in filter view. - * - * @return FormBuilder - */ - public function filter(): FormBuilder - { - // listing view fields - $fields = new FormBuilder(); - - $fields->name('title')->type('text')->group('w-1/6'); - $fields->name('username')->type('text')->group('w-1/6'); - $fields->name('ip_address')->type('text')->group('w-1/6'); - $fields->name('port')->type('text')->group('w-1/6'); - - return $fields; - - } /** * List of fields to be migrated to the datebase when creating or updating model during migration. * * @param Blueprint $table * @return void */ - public function migration(Blueprint $table): void + public function fields(Blueprint $table): void { - $table->increments('id'); - $table->string('title'); - $table->string('username'); - $table->string('password'); - $table->string('database'); - $table->string('ip_address'); - $table->string('port'); - $table->string('type'); - $table->boolean('published')->default(true)->nullable(); + $this->fields->increments('id')->html('text'); + $this->fields->string('title')->html('text'); + $this->fields->string('username')->html('text'); + $this->fields->string('password')->html('password'); + $this->fields->string('database')->html('text'); + $this->fields->string('ip_address')->html('text'); + $this->fields->string('port')->html('text'); + $this->fields->string('type')->html('text'); + $this->fields->boolean('published')->default(true)->nullable()->html('switch'); } } diff --git a/Entities/MacAddress.php b/Entities/MacAddress.php index 00619f8..558568d 100755 --- a/Entities/MacAddress.php +++ b/Entities/MacAddress.php @@ -4,8 +4,6 @@ use Illuminate\Database\Schema\Blueprint; use Modules\Base\Classes\Migration; -use Modules\Base\Classes\Views\FormBuilder; -use Modules\Base\Classes\Views\ListTable; use Modules\Base\Entities\BaseModel; class MacAddress extends BaseModel @@ -38,80 +36,18 @@ class MacAddress extends BaseModel */ protected $table = "isp_mac_address"; - /** - * Function for defining list of fields in table view. - * - * @return ListTable - */ - public function listTable(): ListTable - { - // listing view fields - $fields = new ListTable(); - - $fields->name('subscriber_id')->type('recordpicker')->table(['isp', 'subscriber'])->ordering(true); - $fields->name('mac')->type('text')->ordering(true); - - return $fields; - - } - - /** - * Function for defining list of fields in form view. - * - * @return FormBuilder - */ - public function formBuilder(): FormBuilder - { - // listing view fields - $fields = new FormBuilder(); - - $fields->name('subscriber_id')->type('recordpicker')->table(['isp', 'subscriber'])->group('w-1/2'); - $fields->name('mac')->type('text')->group('w-1/2'); - - return $fields; - - } - - /** - * Function for defining list of fields in filter view. - * - * @return FormBuilder - */ - public function filter(): FormBuilder - { - // listing view fields - $fields = new FormBuilder(); - - $fields->name('subscriber_id')->type('recordpicker')->table(['isp', 'subscriber'])->group('w-1/6'); - $fields->name('mac')->type('text')->group('w-1/6'); - - return $fields; - - } /** * List of fields to be migrated to the datebase when creating or updating model during migration. * * @param Blueprint $table * @return void */ - public function migration(Blueprint $table): void + public function fields(Blueprint $table): void { - $table->increments('id'); - $table->foreignId('subscriber_id')->nullable(); - $table->string('mac')->nullable(); - } - - /** - * Handle post migration processes for adding foreign keys. - * - * @param Blueprint $table - * - * @return void - */ - public function post_migration(Blueprint $table): void - { - Migration::addForeign($table, 'isp_subscriber', 'subscriber_id'); + $this->fields->increments('id')->html('text'); + $this->fields->foreignId('subscriber_id')->nullable()->html('recordpicker')->table(['isp', 'subscriber']); + $this->fields->string('mac')->nullable()->html('text'); } } diff --git a/Entities/Package.php b/Entities/Package.php index ffec783..479f590 100755 --- a/Entities/Package.php +++ b/Entities/Package.php @@ -4,8 +4,6 @@ use Illuminate\Database\Schema\Blueprint; use Modules\Base\Classes\Migration; -use Modules\Base\Classes\Views\FormBuilder; -use Modules\Base\Classes\Views\ListTable; use Modules\Base\Entities\BaseModel; class Package extends BaseModel @@ -42,117 +40,35 @@ class Package extends BaseModel */ protected $table = "isp_package"; - /** - * Function for defining list of fields in table view. - * - * @return ListTable - */ - public function listTable(): ListTable - { - // listing view fields - $fields = new ListTable(); - - $fields->name('title')->type('text')->ordering(true); - $fields->name('slug')->type('text')->ordering(true); - $fields->name('pool')->type('text')->ordering(true); - $fields->name('billing_cycle_id')->type('recordpicker')->table(['isp', 'billing_cycle'])->ordering(true); - $fields->name('gateway_id')->type('recordpicker')->table(['isp', 'gateway'])->ordering(true); - $fields->name('speed')->type('text')->ordering(true); - $fields->name('speed_type')->type('text')->ordering(true); - $fields->name('bundle')->type('text')->ordering(true); - $fields->name('bundle_type')->type('text')->ordering(true); - $fields->name('published')->type('switch')->ordering(true); - - return $fields; - - } - - /** - * Function for defining list of fields in form view. - * - * @return FormBuilder - */ - public function formBuilder(): FormBuilder - { - // listing view fields - $fields = new FormBuilder(); - - $fields->name('title')->type('text')->group('w-1/2'); - $fields->name('slug')->type('text')->group('w-1/2'); - $fields->name('pool')->type('text')->group('w-1/2'); - $fields->name('billing_cycle_id')->type('recordpicker')->table(['isp', 'billing_cycle'])->group('w-1/2'); - $fields->name('gateway_id')->type('recordpicker')->table(['isp', 'gateway'])->group('w-1/2'); - $fields->name('speed')->type('text')->group('w-1/2'); - $fields->name('speed_type')->type('text')->group('w-1/2'); - $fields->name('bundle')->type('text')->group('w-1/2'); - $fields->name('bundle_type')->type('text')->group('w-1/2'); - $fields->name('published')->type('switch')->group('w-1/2'); - $fields->name('description')->type('textarea')->group('w-full'); - - return $fields; - - } - - /** - * Function for defining list of fields in filter view. - * - * @return FormBuilder - */ - public function filter(): FormBuilder - { - // listing view fields - $fields = new FormBuilder(); - - $fields->name('title')->type('text')->group('w-1/6'); - $fields->name('slug')->type('text')->group('w-1/6'); - $fields->name('pool')->type('text')->group('w-1/6'); - $fields->name('billing_cycle_id')->type('recordpicker')->table(['isp', 'billing_cycle'])->group('w-1/6'); - $fields->name('gateway_id')->type('recordpicker')->table(['isp', 'gateway'])->group('w-1/6'); - - return $fields; - - } /** * List of fields to be migrated to the datebase when creating or updating model during migration. * * @param Blueprint $table * @return void */ - public function migration(Blueprint $table): void + public function fields(Blueprint $table): void { - $table->increments('id'); - $table->string('title'); - $table->string('slug'); - $table->string('pool'); - $table->string('description')->nullable(); - - $table->foreignId('billing_cycle_id')->nullable(); - $table->foreignId('gateway_id')->nullable(); - - $table->string('speed')->nullable(); - $table->enum('speed_type', ['gigabyte', 'kilobyte', 'megabyte'])->default('megabyte')->nullable(); - - $table->string('bundle')->nullable(); - $table->enum('bundle_type', ['gigabyte', 'kilobyte', 'megabyte'])->default('megabyte')->nullable(); - - $table->boolean('published')->default(1)->nullable(); - $table->boolean('featured')->default(0)->nullable(); - $table->boolean('default')->default(0)->nullable(); - $table->boolean('is_unlimited')->default(0)->nullable(); - $table->boolean('is_hidden')->default(0)->nullable(); - $table->double('amount', 8, 2)->nullable(); + $this->fields->increments('id')->html('text'); + $this->fields->string('title')->html('text'); + $this->fields->string('slug')->html('text'); + $this->fields->string('pool')->html('text'); + $this->fields->string('description')->nullable()->html('textarea'); + + $this->fields->foreignId('billing_cycle_id')->nullable()->html('recordpicker')->table(['isp', 'billing_cycle']); + $this->fields->foreignId('gateway_id')->nullable()->html('recordpicker')->table(['isp', 'gateway']); + + $this->fields->string('speed')->nullable()->html('text'); + $this->fields->enum('speed_type', ['gigabyte', 'kilobyte', 'megabyte'])->default('megabyte')->nullable()->html('switch'); + + $this->fields->string('bundle')->nullable()->html('text'); + $this->fields->enum('bundle_type', ['gigabyte', 'kilobyte', 'megabyte'])->default('megabyte')->nullable()->html('switch'); + + $this->fields->boolean('published')->default(1)->nullable()->html('switch'); + $this->fields->boolean('featured')->default(0)->nullable()->html('switch'); + $this->fields->boolean('default')->default(0)->nullable()->html('switch'); + $this->fields->boolean('is_unlimited')->default(0)->nullable()->html('switch'); + $this->fields->boolean('is_hidden')->default(0)->nullable()->html('switch'); + $this->fields->double('amount', 8, 2)->nullable()->html('number'); } - /** - * Handle post migration processes for adding foreign keys. - * - * @param Blueprint $table - * - * @return void - */ - public function post_migration(Blueprint $table): void - { - Migration::addForeign($table, 'isp_billing_cycle', 'billing_cycle_id'); - Migration::addForeign($table, 'isp_gateway', 'gateway_id'); - } } diff --git a/Entities/PackageCharge.php b/Entities/PackageCharge.php index eed93d4..93e54a3 100755 --- a/Entities/PackageCharge.php +++ b/Entities/PackageCharge.php @@ -4,8 +4,6 @@ use Illuminate\Database\Schema\Blueprint; use Modules\Base\Classes\Migration; -use Modules\Base\Classes\Views\FormBuilder; -use Modules\Base\Classes\Views\ListTable; use Modules\Base\Entities\BaseModel; class PackageCharge extends BaseModel @@ -38,102 +36,22 @@ class PackageCharge extends BaseModel */ protected $table = "isp_package_charge"; - /** - * Function for defining list of fields in table view. - * - * @return ListTable - */ - public function listTable(): ListTable - { - // listing view fields - $fields = new ListTable(); - - $fields->name('title')->type('text')->ordering(true); - $fields->name('slug')->type('text')->ordering(true); - $fields->name('package_id')->type('recordpicker')->table(['isp', 'package'])->ordering(true); - $fields->name('ledger_id')->type('recordpicker')->table(['account', 'ledger'])->ordering(true); - $fields->name('quantity')->type('text')->ordering(true); - $fields->name('description')->type('textarea')->ordering(true); - $fields->name('price')->type('text')->ordering(true); - $fields->name('published')->type('switch')->ordering(true); - - return $fields; - - } - - /** - * Function for defining list of fields in form view. - * - * @return FormBuilder - */ - public function formBuilder(): FormBuilder - { - // listing view fields - $fields = new FormBuilder(); - - $fields->name('title')->type('text')->group('w-1/2'); - $fields->name('slug')->type('text')->group('w-1/2'); - $fields->name('package_id')->type('recordpicker')->table(['isp', 'package'])->group('w-1/2'); - $fields->name('ledger_id')->type('recordpicker')->table(['account', 'ledger'])->group('w-1/2'); - $fields->name('quantity')->type('text')->group('w-1/2'); - $fields->name('description')->type('textarea')->group('w-full'); - $fields->name('price')->type('text')->group('w-1/2'); - $fields->name('published')->type('switch')->group('w-1/2'); - - return $fields; - - } - - /** - * Function for defining list of fields in filter view. - * - * @return FormBuilder - */ - public function filter(): FormBuilder - { - // listing view fields - $fields = new FormBuilder(); - - $fields->name('title')->type('text')->group('w-1/6'); - $fields->name('slug')->type('text')->group('w-1/6'); - $fields->name('package_id')->type('recordpicker')->table(['isp', 'package'])->group('w-1/6'); - $fields->name('ledger_id')->type('recordpicker')->table(['account', 'ledger'])->group('w-1/6'); - $fields->name('quantity')->type('text')->group('w-1/6'); - $fields->name('price')->type('text')->group('w-1/6'); - $fields->name('published')->type('switch')->group('w-1/6'); - - return $fields; - - } /** * List of fields to be migrated to the datebase when creating or updating model during migration. * * @param Blueprint $table * @return void */ - public function migration(Blueprint $table): void - { - $table->increments('id'); - $table->string('title'); - $table->string('slug'); - $table->foreignId('package_id'); - $table->foreignId('ledger_id'); - $table->tinyInteger('quantity')->default(1); - $table->string('description')->nullable(); - $table->double('price', 8, 2)->nullable(); - $table->boolean('published')->default(true)->nullable(); - } - - /** - * Handle post migration processes for adding foreign keys. - * - * @param Blueprint $table - * - * @return void - */ - public function post_migration(Blueprint $table): void + public function fields(Blueprint $table): void { - Migration::addForeign($table, 'isp_package', 'package_id'); - Migration::addForeign($table, 'account_ledger', 'ledger_id'); + $this->fields->increments('id')->html('text'); + $this->fields->string('title')->html('text'); + $this->fields->string('slug')->html('text'); + $this->fields->foreignId('package_id')->html('recordpicker')->table(['isp', 'package']); + $this->fields->foreignId('ledger_id')->html('recordpicker')->table(['account', 'ledger']); + $this->fields->tinyInteger('quantity')->default(1)->html('text'); + $this->fields->string('description')->nullable()->html('textarea'); + $this->fields->double('price', 8, 2)->nullable()->html('number'); + $this->fields->boolean('published')->default(true)->nullable()->html('switch'); } } diff --git a/Entities/PackageChargeRate.php b/Entities/PackageChargeRate.php index 14842ef..7f4762b 100755 --- a/Entities/PackageChargeRate.php +++ b/Entities/PackageChargeRate.php @@ -42,24 +42,12 @@ class PackageChargeRate extends BaseModel * @param Blueprint $table * @return void */ - public function migration(Blueprint $table): void + public function fields(Blueprint $table): void { - $table->increments('id'); - $table->foreignId('package_charge_id'); - $table->foreignId('rate_id'); - $table->boolean('published')->default(true)->nullable(); + $this->fields->increments('id')->html('text'); + $this->fields->foreignId('package_charge_id')->html('recordpicker')->table(['isp', 'package_charge']); + $this->fields->foreignId('rate_id')->html('recordpicker')->table(['account', 'rate']); + $this->fields->boolean('published')->default(true)->nullable()->html('switch'); } - /** - * Handle post migration processes for adding foreign keys. - * - * @param Blueprint $table - * - * @return void - */ - public function post_migration(Blueprint $table): void - { - Migration::addForeign($table, 'isp_package_charge', 'package_charge_id'); - Migration::addForeign($table, 'account_rate', 'rate_id'); - } } diff --git a/Entities/Payment.php b/Entities/Payment.php index 7ec298b..2879103 100755 --- a/Entities/Payment.php +++ b/Entities/Payment.php @@ -38,94 +38,23 @@ class Payment extends BaseModel */ protected $table = "isp_payment"; - /** - * Function for defining list of fields in table view. - * - * @return ListTable - */ - public function listTable(): ListTable - { - // listing view fields - $fields = new ListTable(); - - $fields->name('title')->type('text')->ordering(true); - $fields->name('subscription_id')->type('recordpicker')->table(['isp', 'subscription'])->ordering(true); - $fields->name('invoice_id')->type('recordpicker')->table(['account', 'invoice'])->ordering(true); - $fields->name('is_paid')->type('switch')->ordering(true); - $fields->name('completed')->type('switch')->ordering(true); - $fields->name('successful')->type('switch')->ordering(true); - - return $fields; - - } - - /** - * Function for defining list of fields in form view. - * - * @return FormBuilder - */ - public function formBuilder(): FormBuilder - { - // listing view fields - $fields = new FormBuilder(); - - $fields->name('title')->type('text')->group('w-1/2'); - $fields->name('subscription_id')->type('recordpicker')->table(['isp', 'subscription'])->group('w-1/2'); - $fields->name('invoice_id')->type('recordpicker')->table(['account', 'invoice'])->group('w-1/2'); - $fields->name('is_paid')->type('switch')->group('w-1/2'); - $fields->name('completed')->type('switch')->group('w-1/2'); - $fields->name('successful')->type('switch')->group('w-1/2'); - $fields->name('description')->type('textarea')->group('w-full'); - - return $fields; - - } - - /** - * Function for defining list of fields in filter view. - * - * @return FormBuilder - */ - public function filter(): FormBuilder - { - // listing view fields - $fields = new FormBuilder(); - - $fields->name('title')->type('text')->group('w-1/6'); - $fields->name('subscription_id')->type('recordpicker')->table(['isp', 'subscription'])->group('w-1/6'); - $fields->name('invoice_id')->type('recordpicker')->table(['account', 'invoice'])->group('w-1/6'); - - return $fields; - - } /** * List of fields to be migrated to the datebase when creating or updating model during migration. * * @param Blueprint $table * @return void */ - public function migration(Blueprint $table): void + public function fields(Blueprint $table): void { - $table->increments('id'); - $table->string('title'); - $table->foreignId('subscription_id')->nullable(); - $table->foreignId('invoice_id')->nullable(); - $table->string('description')->nullable(); - $table->boolean('is_paid')->default(0)->nullable(); - $table->boolean('completed')->default(0)->nullable(); - $table->boolean('successful')->default(0)->nullable(); + $this->fields->increments('id')->html('text'); + $this->fields->string('title')->html('text'); + $this->fields->foreignId('subscription_id')->nullable()->html('recordpicker')->table(['isp', 'subscription']); + $this->fields->foreignId('invoice_id')->nullable()->html('recordpicker')->table(['account', 'invoice']); + $this->fields->string('description')->nullable()->html('textarea'); + $this->fields->boolean('is_paid')->default(0)->nullable()->html('switch'); + $this->fields->boolean('completed')->default(0)->nullable()->html('switch'); + $this->fields->boolean('successful')->default(0)->nullable()->html('switch'); } - /** - * Handle post migration processes for adding foreign keys. - * - * @param Blueprint $table - * - * @return void - */ - public function post_migration(Blueprint $table): void - { - Migration::addForeign($table, 'isp_subscription', 'subscription_id'); - Migration::addForeign($table, 'account_invoice', 'invoice_id'); - } + } diff --git a/Entities/PaymentCharge.php b/Entities/PaymentCharge.php index c762fc2..d3550e0 100755 --- a/Entities/PaymentCharge.php +++ b/Entities/PaymentCharge.php @@ -4,8 +4,6 @@ use Illuminate\Database\Schema\Blueprint; use Modules\Base\Classes\Migration; -use Modules\Base\Classes\Views\FormBuilder; -use Modules\Base\Classes\Views\ListTable; use Modules\Base\Entities\BaseModel; class PaymentCharge extends BaseModel @@ -38,99 +36,23 @@ class PaymentCharge extends BaseModel */ protected $table = "isp_payment_charge"; - /** - * Function for defining list of fields in table view. - * - * @return ListTable - */ - public function listTable(): ListTable - { - // listing view fields - $fields = new ListTable(); - - $fields->name('title')->type('text')->ordering(true); - $fields->name('slug')->type('text')->ordering(true); - $fields->name('price')->type('text')->ordering(true); - $fields->name('payment_id')->type('recordpicker')->table(['isp', 'payment'])->ordering(true); - $fields->name('ledger_id')->type('recordpicker')->table(['account', 'ledger'])->ordering(true); - $fields->name('quantity')->type('text')->ordering(true); - $fields->name('published')->type('switch')->ordering(true); - - return $fields; - - } - - /** - * Function for defining list of fields in form view. - * - * @return FormBuilder - */ - public function formBuilder(): FormBuilder - { - // listing view fields - $fields = new FormBuilder(); - - $fields->name('title')->type('text')->group('w-1/2'); - $fields->name('slug')->type('text')->group('w-1/2'); - $fields->name('price')->type('text')->group('w-1/2'); - $fields->name('payment_id')->type('recordpicker')->table(['isp', 'payment'])->group('w-1/2'); - $fields->name('ledger_id')->type('recordpicker')->table(['account', 'ledger'])->group('w-1/2'); - $fields->name('quantity')->type('text')->group('w-1/2'); - $fields->name('published')->type('switch')->group('w-1/2'); - $fields->name('description')->type('textarea')->group('w-full'); - - return $fields; - - } - - /** - * Function for defining list of fields in filter view. - * - * @return FormBuilder - */ - public function filter(): FormBuilder - { - // listing view fields - $fields = new FormBuilder(); - - $fields->name('title')->type('text')->group('w-1/6'); - $fields->name('slug')->type('text')->group('w-1/6'); - $fields->name('payment_id')->type('recordpicker')->table(['isp', 'payment'])->group('w-1/6'); - $fields->name('ledger_id')->type('recordpicker')->table(['account', 'ledger'])->group('w-1/6'); - $fields->name('published')->type('switch')->group('w-1/6'); - - return $fields; - - } /** * List of fields to be migrated to the datebase when creating or updating model during migration. * * @param Blueprint $table * @return void */ - public function migration(Blueprint $table): void + public function fields(Blueprint $table): void { - $table->increments('id'); - $table->string('title'); - $table->string('slug'); - $table->foreignId('payment_id'); - $table->foreignId('ledger_id'); - $table->integer('quantity')->default(1); - $table->string('description')->nullable(); - $table->double('price', 8, 2)->nullable(); - $table->boolean('published')->default(true)->nullable(); + $this->fields->increments('id')->html('text'); + $this->fields->string('title')->html('text'); + $this->fields->string('slug')->html('text'); + $this->fields->foreignId('payment_id')->html('recordpicker')->table(['isp', 'payment']); + $this->fields->foreignId('ledger_id')->html('recordpicker')->table(['account', 'ledger']); + $this->fields->integer('quantity')->default(1)->html('number'); + $this->fields->string('description')->nullable()->html('textarea'); + $this->fields->double('price', 8, 2)->nullable()->html('number'); + $this->fields->boolean('published')->default(true)->nullable()->html('switch'); } - /** - * Handle post migration processes for adding foreign keys. - * - * @param Blueprint $table - * - * @return void - */ - public function post_migration(Blueprint $table): void - { - Migration::addForeign($table, 'isp_payment', 'payment_id'); - Migration::addForeign($table, 'account_ledger', 'ledger_id'); - } } diff --git a/Entities/PaymentChargeRate.php b/Entities/PaymentChargeRate.php index 48a51a2..ca8528b 100755 --- a/Entities/PaymentChargeRate.php +++ b/Entities/PaymentChargeRate.php @@ -4,8 +4,6 @@ use Illuminate\Database\Schema\Blueprint; use Modules\Base\Classes\Migration; -use Modules\Base\Classes\Views\FormBuilder; -use Modules\Base\Classes\Views\ListTable; use Modules\Base\Entities\BaseModel; class PaymentChargeRate extends BaseModel @@ -38,79 +36,17 @@ class PaymentChargeRate extends BaseModel */ protected $table = "isp_payment_charge_rate"; - /** - * Function for defining list of fields in table view. - * - * @return ListTable - */ - public function listTable(): ListTable - { - // listing view fields - $fields = new ListTable(); - - $fields->name('payment_charge_id')->type('recordpicker')->table(['isp', 'payment_charge'])->ordering(true); - $fields->name('rate_id')->type('recordpicker')->table(['account', 'rate'])->ordering(true); - - return $fields; - - } - - /** - * Function for defining list of fields in form view. - * - * @return FormBuilder - */ - public function formBuilder(): FormBuilder - { - // listing view fields - $fields = new FormBuilder(); - - $fields->name('payment_charge_id')->type('recordpicker')->table(['isp', 'payment_charge'])->group('w-1/2'); - $fields->name('rate_id')->type('recordpicker')->table(['account', 'rate'])->group('w-1/2'); - - return $fields; - - } - - /** - * Function for defining list of fields in filter view. - * - * @return FormBuilder - */ - public function filter(): FormBuilder - { - // listing view fields - $fields = new FormBuilder(); - - $fields->name('payment_charge_id')->type('recordpicker')->table(['isp', 'payment_charge'])->group('w-1/2'); - $fields->name('rate_id')->type('recordpicker')->table(['account', 'rate'])->group('w-1/2'); - - return $fields; - - } /** * List of fields to be migrated to the datebase when creating or updating model during migration. * * @param Blueprint $table * @return void */ - public function migration(Blueprint $table): void + public function fields(Blueprint $table): void { - $table->increments('id'); - $table->foreignId('payment_charge_id'); - $table->foreignId('rate_id'); + $this->fields->increments('id'); + $this->fields->foreignId('payment_charge_id')->html('recordpicker')->table(['isp', 'payment_charge']); + $this->fields->foreignId('rate_id')->html('recordpicker')->table(['account', 'rate']); } - /** - * Handle post migration processes for adding foreign keys. - * - * @param Blueprint $table - * - * @return void - */ - public function post_migration(Blueprint $table): void - { - Migration::addForeign($table, 'isp_payment_charge', 'payment_charge_id'); - Migration::addForeign($table, 'account_rate', 'rate_id'); - } } diff --git a/Entities/Subscriber.php b/Entities/Subscriber.php index be600fd..5697f8f 100755 --- a/Entities/Subscriber.php +++ b/Entities/Subscriber.php @@ -4,8 +4,6 @@ use Illuminate\Database\Schema\Blueprint; use Modules\Base\Classes\Migration; -use Modules\Base\Classes\Views\FormBuilder; -use Modules\Base\Classes\Views\ListTable; use Modules\Base\Entities\BaseModel; class Subscriber extends BaseModel @@ -17,15 +15,13 @@ class Subscriber extends BaseModel */ protected $fillable = ['username', 'password', 'had_trail', 'partner_id']; - /** * The fields that are to be render when performing relationship queries. * * @var array */ public $rec_names = ['username']; - - + /** * List of tables names that are need in this model during migration. * @@ -40,84 +36,18 @@ class Subscriber extends BaseModel */ protected $table = "isp_subscriber"; - /** - * Function for defining list of fields in table view. - * - * @return ListTable - */ - public function listTable(): ListTable - { - // listing view fields - $fields = new ListTable(); - - $fields->name('username')->type('text')->ordering(true); - $fields->name('had_trail')->type('switch')->ordering(true); - $fields->name('partner_id')->type('recordpicker')->table(['partner'])->ordering(true); - - return $fields; - - } - - /** - * Function for defining list of fields in form view. - * - * @return FormBuilder - */ - public function formBuilder(): FormBuilder - { - // listing view fields - $fields = new FormBuilder(); - - $fields->name('username')->type('text')->group('w-1/2'); - $fields->name('password')->type('password')->group('w-1/2'); - $fields->name('had_trail')->type('switch')->group('w-1/2'); - $fields->name('partner_id')->type('recordpicker')->table(['partner'])->group('w-1/2'); - - return $fields; - - } - - /** - * Function for defining list of fields in filter view. - * - * @return FormBuilder - */ - public function filter(): FormBuilder - { - // listing view fields - $fields = new FormBuilder(); - - $fields->name('username')->type('text')->group('w-1/6'); - $fields->name('had_trail')->type('switch')->group('w-1/6'); - $fields->name('partner_id')->type('recordpicker')->table(['partner'])->group('w-1/6'); - - return $fields; - - } /** * List of fields to be migrated to the datebase when creating or updating model during migration. * * @param Blueprint $table * @return void */ - public function migration(Blueprint $table): void - { - $table->increments('id'); - $table->string('username')->unique(); - $table->string('password'); - $table->boolean('had_trail')->default(0)->nullable(); - $table->foreignId('partner_id')->nullable(); - } - - /** - * Handle post migration processes for adding foreign keys. - * - * @param Blueprint $table - * - * @return void - */ - public function post_migration(Blueprint $table): void + public function fields(Blueprint $table): void { - Migration::addForeign($table, 'partner', 'partner_id'); + $this->fields->increments('id')->html('text'); + $this->fields->string('username')->unique()->html('text'); + $this->fields->string('password')->html('text'); + $this->fields->boolean('had_trail')->default(0)->nullable()->html('switch'); + $this->fields->foreignId('partner_id')->nullable()->html('recordpicker')->table(['partner']); } } diff --git a/Entities/SubscriberLogin.php b/Entities/SubscriberLogin.php index d8fa739..0a5ed07 100755 --- a/Entities/SubscriberLogin.php +++ b/Entities/SubscriberLogin.php @@ -4,8 +4,6 @@ use Illuminate\Database\Schema\Blueprint; use Modules\Base\Classes\Migration; -use Modules\Base\Classes\Views\FormBuilder; -use Modules\Base\Classes\Views\ListTable; use Modules\Base\Entities\BaseModel; class SubscriberLogin extends BaseModel @@ -38,93 +36,27 @@ class SubscriberLogin extends BaseModel */ protected $table = "isp_subscriber_login"; - /** - * Function for defining list of fields in table view. - * - * @return ListTable - */ - public function listTable(): ListTable - { - // listing view fields - $fields = new ListTable(); - - $fields->name('mac')->type('text')->ordering(true); - $fields->name('ip')->type('text')->ordering(true); - $fields->name('username')->type('text')->ordering(true); - $fields->name('link_login')->type('text')->ordering(true); - $fields->name('link_orig')->type('text')->ordering(true); - $fields->name('error')->type('text')->ordering(true); - $fields->name('chap_id')->type('text')->ordering(true); - $fields->name('chap_challenge')->type('text')->ordering(true); - - return $fields; - - } - - /** - * Function for defining list of fields in form view. - * - * @return FormBuilder - */ - public function formBuilder(): FormBuilder - { - // listing view fields - $fields = new FormBuilder(); - - $fields->name('mac')->type('text')->group('w-1/2'); - $fields->name('ip')->type('text')->group('w-1/2'); - $fields->name('username')->type('text')->group('w-1/2'); - $fields->name('link_login')->type('text')->group('w-1/2'); - $fields->name('link_orig')->type('text')->group('w-1/2'); - $fields->name('error')->type('text')->group('w-1/2'); - $fields->name('chap_id')->type('text')->group('w-1/2'); - $fields->name('chap_challenge')->type('text')->group('w-1/2'); - $fields->name('link_login_id')->type('text')->group('w-1/2'); - $fields->name('link_orig_esc')->type('text')->group('w-1/2'); - $fields->name('mac_esc')->type('text')->group('w-1/2'); - - return $fields; - - } - - /** - * Function for defining list of fields in filter view. - * - * @return FormBuilder - */ - public function filter(): FormBuilder - { - // listing view fields - $fields = new FormBuilder(); - - $fields->name('mac')->type('text')->group('w-1/2'); - $fields->name('ip')->type('text')->group('w-1/2'); - $fields->name('username')->type('text')->group('w-1/2'); - - return $fields; - - } /** * List of fields to be migrated to the datebase when creating or updating model during migration. * * @param Blueprint $table * @return void */ - public function migration(Blueprint $table): void + public function fields(Blueprint $table): void { - $table->increments('id'); - $table->string('mac')->nullable(); - $table->string('ip')->nullable(); - $table->string('username')->nullable(); - $table->string('link_login')->nullable(); - $table->string('link_orig')->nullable(); - $table->string('error')->nullable(); - $table->string('chap_id')->nullable(); - $table->string('chap_challenge')->nullable(); - $table->string('link_login_id')->nullable(); - $table->string('link_orig_esc')->nullable(); - $table->string('mac_esc')->nullable(); + $this->fields->increments('id')->html('text'); + $this->fields->string('mac')->nullable()->html('text'); + $this->fields->string('ip')->nullable()->html('text'); + $this->fields->string('username')->nullable()->html('text'); + $this->fields->string('link_login')->nullable()->html('text'); + $this->fields->string('link_orig')->nullable()->html('text'); + $this->fields->string('error')->nullable()->html('text'); + $this->fields->string('chap_id')->nullable()->html('text'); + $this->fields->string('chap_challenge')->nullable()->html('text'); + $this->fields->string('link_login_id')->nullable()->html('text'); + $this->fields->string('link_orig_esc')->nullable()->html('text'); + $this->fields->string('mac_esc')->nullable()->html('text'); } } diff --git a/Entities/Subscription.php b/Entities/Subscription.php index 4eff837..fe7d764 100755 --- a/Entities/Subscription.php +++ b/Entities/Subscription.php @@ -38,87 +38,19 @@ class Subscription extends BaseModel */ protected $table = "isp_subscription"; - /** - * Function for defining list of fields in table view. - * - * @return ListTable - */ - public function listTable(): ListTable - { - // listing view fields - $fields = new ListTable(); - - $fields->name('subscriber_id')->type('recordpicker')->table(['isp', 'subscriber'])->ordering(true); - $fields->name('package_id')->type('recordpicker')->table(['isp', 'package'])->ordering(true); - $fields->name('start_date')->type('datetime')->ordering(true); - $fields->name('end_date')->type('datetime')->ordering(true); - - return $fields; - - } - - /** - * Function for defining list of fields in form view. - * - * @return FormBuilder - */ - public function formBuilder(): FormBuilder - { - // listing view fields - $fields = new FormBuilder(); - - $fields->name('subscriber_id')->type('recordpicker')->table(['isp', 'subscriber'])->group('w-1/2'); - $fields->name('package_id')->type('recordpicker')->table(['isp', 'package'])->group('w-1/2'); - $fields->name('start_date')->type('datetime')->group('w-1/2'); - $fields->name('end_date')->type('datetime')->group('w-1/2'); - - return $fields; - - } - - /** - * Function for defining list of fields in filter view. - * - * @return FormBuilder - */ - public function filter(): FormBuilder - { - // listing view fields - $fields = new FormBuilder(); - - $fields->name('subscriber_id')->type('recordpicker')->table(['isp', 'subscriber'])->group('w-1/2'); - $fields->name('package_id')->type('recordpicker')->table(['isp', 'package'])->group('w-1/2'); - $fields->name('start_date')->type('datetime')->group('w-1/2'); - $fields->name('end_date')->type('datetime')->group('w-1/2'); - - return $fields; - - } /** * List of fields to be migrated to the datebase when creating or updating model during migration. * * @param Blueprint $table * @return void */ - public function migration(Blueprint $table): void + public function fields(Blueprint $table): void { - $table->increments('id'); - $table->foreignId('subscriber_id'); - $table->foreignId('package_id'); - $table->datetime('start_date'); - $table->datetime('end_date'); + $this->fields->increments('id')->html('text'); + $this->fields->foreignId('subscriber_id')->html('recordpicker')->table(['isp', 'subscriber']); + $this->fields->foreignId('package_id')->html('recordpicker')->table(['isp', 'package']); + $this->fields->datetime('start_date')->html('datetime'); + $this->fields->datetime('end_date')->html('datetime'); } - /** - * Handle post migration processes for adding foreign keys. - * - * @param Blueprint $table - * - * @return void - */ - public function post_migration(Blueprint $table): void - { - Migration::addForeign($table, 'isp_subscriber', 'subscriber_id'); - Migration::addForeign($table, 'isp_package', 'package_id'); - } }