Skip to content

Commit

Permalink
Changes to files: Entities/BillingCycle.php
Browse files Browse the repository at this point in the history
Entities/Gateway.php
Entities/MacAddress.php
Entities/Package.php
Entities/PackageCharge.php
Entities/PackageChargeRate.php
Entities/Payment.php
Entities/PaymentCharge.php
Entities/PaymentChargeRate.php
Entities/Subscriber.php
Entities/SubscriberLogin.php
Entities/Subscription.php
  • Loading branch information
dedanirungu committed Aug 14, 2023
1 parent a92521e commit 76e4a33
Show file tree
Hide file tree
Showing 12 changed files with 109 additions and 896 deletions.
77 changes: 8 additions & 69 deletions Entities/BillingCycle.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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');
}
}
85 changes: 10 additions & 75 deletions Entities/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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');
}

}
72 changes: 4 additions & 68 deletions Entities/MacAddress.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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');
}

}
Loading

0 comments on commit 76e4a33

Please sign in to comment.