Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/syn.corals.io/Corals/modules/Syndicate/database/migrations/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/syn.corals.io/Corals/modules/Syndicate/database/migrations/SyndicateTables.php
<?php

namespace Corals\Modules\Syndicate\database\migrations;

use Corals\Modules\Utility\Models\ListOfValue\ListOfValue;
use Corals\User\Models\User;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class SyndicateTables extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        $listOfValuesTableName = ListOfValue::getTableName();
        $usersTableName = User::getTableName();

        Schema::table('users', function (Blueprint $table) use ($listOfValuesTableName) {
            $table->boolean('is_chairman')->default(false);
            $table->boolean('takaful_dail')->default(false);
            $table->string('second_name')->after('name')->nullable();
            $table->string('third_name')->after('second_name')->nullable();
            $table->date('death_date')->after('third_name')->nullable();
            $table->string('id_number')->after('death_date')->nullable();

            $table->string('city_code')->after('integration_id')->nullable();

            $table->string('district_code')->after('integration_id')->nullable();

            $table->string('status_code')->after('integration_id')->nullable();

            $table->string('gender_code')->after('integration_id')->nullable();
            $table->string('passport_code')->after('integration_id')->nullable();
            $table->string('situation_code')->after('integration_id')->nullable();
            $table->string('archive_code')->after('integration_id')->nullable();
            $table->string('religion_code')->after('integration_id')->nullable();
            $table->string('exam_required')->after('integration_id')->nullable();

            // column & foreign
            $table->foreign('city_code')->references('code')->on($listOfValuesTableName)
                ->cascadeOnUpdate()->restrictOnDelete();
            $table->foreign('status_code')->references('code')->on($listOfValuesTableName)
                ->cascadeOnUpdate()->restrictOnDelete();
            $table->foreign('gender_code')->references('code')->on($listOfValuesTableName)
                ->cascadeOnUpdate()->restrictOnDelete();
            $table->foreign('passport_code')->references('code')->on($listOfValuesTableName)
                ->cascadeOnUpdate()->restrictOnDelete();

            $table->foreign('situation_code')->references('code')->on($listOfValuesTableName)
                ->cascadeOnUpdate()->restrictOnDelete();
            $table->foreign('archive_code')->references('code')->on($listOfValuesTableName)
                ->cascadeOnUpdate()->restrictOnDelete();
            $table->foreign('religion_code')->references('code')->on($listOfValuesTableName)
                ->cascadeOnUpdate()->restrictOnDelete();
            $table->foreign('exam_required')->references('code')->on($listOfValuesTableName)
                ->cascadeOnUpdate()->restrictOnDelete();
        });

        Schema::create('syndicate_user_academies',
            function (Blueprint $table) use ($listOfValuesTableName, $usersTableName) {
                $table->id();
                $table->string('graduate_city');
                $table->year('joining_year');
                $table->year('graduate_year');

                // columns & foreign

                $table->string('university_code');//in list of item
                $table->foreign('university_code')->on($listOfValuesTableName)->references('code')
                    ->cascadeOnUpdate()->restrictOnDelete();

                $table->string('certificate_code');//in list of item
                $table->foreign('certificate_code')->on($listOfValuesTableName)->references('code')
                    ->cascadeOnUpdate()->restrictOnDelete();

                $table->unsignedInteger('created_by')->nullable();
                $table->foreign('created_by')->on($usersTableName)->references('id')
                    ->cascadeOnUpdate()->restrictOnDelete();

                $table->unsignedInteger('updated_by')->nullable();
                $table->foreign('updated_by')->on($usersTableName)->references('id')
                    ->cascadeOnUpdate()->restrictOnDelete();

                $table->unsignedInteger('user_id');
                $table->foreign('user_id')->on($usersTableName)->references('id')
                    ->cascadeOnUpdate()->restrictOnDelete();

                $table->text('properties')->nullable();

                $table->softDeletes();
                $table->timestamps();
            });

        Schema::create('syndicate_user_jobs',
            function (Blueprint $table) use ($listOfValuesTableName, $usersTableName) {
                $table->id();
                $table->string('job_place');

                // columns & foreign

                $table->string('district_code');//in list of item
                $table->foreign('district_code')->on($listOfValuesTableName)->references('code')
                    ->cascadeOnUpdate()->restrictOnDelete();

                $table->string('city_code');
                $table->foreign('city_code')->on($listOfValuesTableName)->references('code')->cascadeOnUpdate()->restrictOnDelete();


                $table->string('category_code');//in list of item
                $table->foreign('category_code')->on($listOfValuesTableName)->references('code')
                    ->cascadeOnUpdate()->restrictOnDelete();

                $table->unsignedInteger('created_by')->nullable();
                $table->foreign('created_by')->on($usersTableName)->references('id')
                    ->cascadeOnUpdate()->restrictOnDelete();

                $table->unsignedInteger('updated_by')->nullable();
                $table->foreign('updated_by')->on($usersTableName)->references('id')
                    ->cascadeOnUpdate()->restrictOnDelete();

                $table->unsignedInteger('user_id');
                $table->foreign('user_id')->on($usersTableName)->references('id')
                    ->cascadeOnUpdate()->restrictOnDelete();

                $table->text('properties')->nullable();

                $table->softDeletes();
                $table->timestamps();
            });


        Schema::create('syndicate_factories',
            function (Blueprint $table) use ($listOfValuesTableName, $usersTableName) {
                $table->id();

                // define factory
                $table->string('name');

                $table->unsignedInteger('user_id');
                $table->foreign('user_id')->on($usersTableName)->references('id');

                $table->date('opening_date')->nullable();

                // address info
                $table->string('street')->nullable();

                $table->string('city_code');
                $table->foreign('city_code')->on($listOfValuesTableName)->references('code');

                $table->string('district_code');
                $table->foreign('district_code')->on($listOfValuesTableName)->references('code');

                // contact info
                $table->string('phone')->nullable();
                $table->string('mobile1')->nullable();
                $table->string('mobile2')->nullable();
                $table->string('fax')->nullable();
                $table->string('email')->nullable();

                // framework
                $table->unsignedInteger('created_by')->nullable();
                $table->foreign('created_by')->on($usersTableName)->references('id')
                    ->cascadeOnUpdate()->restrictOnDelete();

                $table->unsignedInteger('updated_by')->nullable();
                $table->foreign('updated_by')->on($usersTableName)->references('id')
                    ->cascadeOnUpdate()->restrictOnDelete();

                $table->text('properties')->nullable();

                $table->softDeletes();
                $table->timestamps();
            });


        Schema::create('syndicate_pharmacies',
            function (Blueprint $table) use ($listOfValuesTableName, $usersTableName) {
                $table->id();

                // define pharmacy
                $table->string('name')->nullable();

                $table->unsignedInteger('user_id');
                $table->foreign('user_id')->on($usersTableName)->references('id');

                $table->date('opening_date')->nullable();

                // address info
                $table->string('street')->nullable();

                $table->string('city_code');
                $table->foreign('city_code')->on($listOfValuesTableName)->references('code');

                $table->string('district_code');
                $table->foreign('district_code')->on($listOfValuesTableName)->references('code');

                // contact info
                $table->string('phone')->nullable();
                $table->string('mobile1')->nullable();
                $table->string('mobile2')->nullable();
                $table->string('fax')->nullable();
                $table->string('email')->nullable();

                // framework
                $table->unsignedInteger('created_by')->nullable();
                $table->foreign('created_by')->on($usersTableName)->references('id')
                    ->cascadeOnUpdate()->restrictOnDelete();

                $table->unsignedInteger('updated_by')->nullable();
                $table->foreign('updated_by')->on($usersTableName)->references('id')
                    ->cascadeOnUpdate()->restrictOnDelete();

                $table->text('properties')->nullable();

                $table->softDeletes();
                $table->timestamps();
            });

        Schema::create('syndicate_trainings', function (Blueprint $table) use ($usersTableName) {
            $table->id();
            $table->string('place')->nullable();

            $table->date('start_date')->nullable();
            $table->date('end_date')->nullable();

            // framework
            $table->unsignedInteger('created_by')->nullable();
            $table->foreign('created_by')->on($usersTableName)->references('id');

            $table->unsignedInteger('updated_by')->nullable();
            $table->foreign('updated_by')->on($usersTableName)->references('id');

            $table->unsignedInteger('user_id');
            $table->foreign('user_id')->on($usersTableName)->references('id');

            $table->decimal('hours')->nullable();
            $table->text('properties')->nullable();

            $table->softDeletes();
            $table->timestamps();
        });


        Schema::create('syndicate_warehouses',
            function (Blueprint $table) use ($listOfValuesTableName, $usersTableName) {
                $table->id();
                //define warehouse
                $table->string('name');

                $table->date('opening_date')->nullable();
                $table->decimal('area')->nullable();
                $table->string('street')->nullable();

                $table->string('city_code')->nullable();
                $table->foreign('city_code')->on($listOfValuesTableName)->references('code');

                $table->string('district_code')->nullable();
                $table->foreign('district_code')->on($listOfValuesTableName)->references('code');

                // contact info
                $table->string('phone')->nullable();
                $table->string('mobile1')->nullable();
                $table->string('mobile2')->nullable();
                $table->string('fax')->nullable();
                $table->string('email')->nullable();

                $table->unsignedInteger('created_by')->nullable();
                $table->foreign('created_by')->on($usersTableName)->references('id');

                $table->unsignedInteger('updated_by')->nullable();
                $table->foreign('updated_by')->on($usersTableName)->references('id');

                $table->text('properties')->nullable();
                $table->softDeletes();
                $table->timestamps();
            });

        Schema::create('syndicate_warehouse_pharmacist',
            function (Blueprint $table) use ($listOfValuesTableName, $usersTableName) {
                $table->id();
                $table->unsignedBigInteger('warehouse_id');
                $table->foreign('warehouse_id')
                    ->on('syndicate_warehouses')
                    ->references('id')
                    ->onDelete('cascade');

                $table->unsignedInteger('user_id');
                $table->foreign('user_id')->on($usersTableName)->references('id')->onDelete('cascade');
                $table->decimal('percentage')->nullable();
                $table->boolean('is_responsible')->default(false);
                $table->text('properties')->nullable();

                $table->softDeletes();
                $table->timestamps();
            });

        Schema::create('syndicate_loans', function (Blueprint $table) use ($listOfValuesTableName, $usersTableName) {
            $table->id();
            $table->integer('amount')->nullable();
            $table->text('details')->nullable();
            $table->string('status')->nullable();

            $table->string('currency_code')->nullable();
            $table->foreign('currency_code')->on($listOfValuesTableName)->references('code')
                ->cascadeOnUpdate()->restrictOnDelete();

            $table->unsignedInteger('user_id');
            $table->foreign('user_id')->on($usersTableName)->references('id');
            $table->unsignedInteger('created_by')->nullable();
            $table->foreign('created_by')->on($usersTableName)->references('id');
            $table->unsignedInteger('updated_by')->nullable();
            $table->foreign('updated_by')->on($usersTableName)->references('id');
            $table->text('properties')->nullable();

            $table->softDeletes();
            $table->timestamps();
        });

        Schema::create('syndicate_insurance_members',
            function (Blueprint $table) use ($listOfValuesTableName, $usersTableName) {
                $table->id();

                $table->string('id_number')->nullable();
                $table->string('name')->nullable();
                $table->string('relationship_code')->nullable();
                $table->foreign('relationship_code')->on($listOfValuesTableName)->references('code')
                    ->cascadeOnUpdate()->restrictOnDelete();

                $table->date('birthdate')->nullable();

                $table->unsignedInteger('user_id');
                $table->foreign('user_id')->on($usersTableName)->references('id');
                $table->unsignedInteger('created_by')->nullable();
                $table->foreign('created_by')->on($usersTableName)->references('id');
                $table->unsignedInteger('updated_by')->nullable();
                $table->foreign('updated_by')->on($usersTableName)->references('id');
                $table->text('properties')->nullable();
                $table->softDeletes();
                $table->timestamps();
            });
        Schema::create('syndicate_beneficiaries',
            function (Blueprint $table) use ($listOfValuesTableName, $usersTableName) {
                $table->id();

                $table->string('name')->nullable();
                $table->string('relationship_code')->nullable();
                $table->foreign('relationship_code')->on($listOfValuesTableName)->references('code')
                    ->cascadeOnUpdate()->restrictOnDelete();

                $table->decimal('percentage')->nullable();

                $table->unsignedInteger('user_id');
                $table->foreign('user_id')->on($usersTableName)->references('id');
                $table->unsignedInteger('created_by')->nullable();
                $table->foreign('created_by')->on($usersTableName)->references('id');
                $table->unsignedInteger('updated_by')->nullable();
                $table->foreign('updated_by')->on($usersTableName)->references('id');
                $table->text('properties')->nullable();
                $table->softDeletes();
                $table->timestamps();
            });
        Schema::create('syndicate_councils', function (Blueprint $table) use ($listOfValuesTableName, $usersTableName) {
            $table->id();
            $table->integer('penalty')->nullable();

            $table->date('date_of_council')->nullable();
            $table->text('details')->nullable();
            $table->unsignedInteger('user_id');
            $table->foreign('user_id')->on($usersTableName)->references('id');

            $table->unsignedInteger('created_by')->nullable();
            $table->foreign('created_by')->on($usersTableName)->references('id');
            $table->unsignedInteger('updated_by')->nullable();
            $table->foreign('updated_by')->on($usersTableName)->references('id');
            $table->text('properties')->nullable();
            $table->softDeletes();
            $table->timestamps();
        });

        Schema::create('syndicate_certificate_bans',
            function (Blueprint $table) use ($listOfValuesTableName, $usersTableName) {
                $table->id();

                $table->unsignedBigInteger('council_id');
                $table->foreign('council_id')->on('syndicate_councils')->references('id')->onDelete('cascade');
                $table->unsignedInteger('user_id');
                $table->foreign('user_id')->on($usersTableName)->references('id')->onDelete('cascade');
                $table->date('start_withdrawn_license')->nullable();
                $table->date('end_withdrawn_license')->nullable();
                $table->unsignedInteger('created_by')->nullable();
                $table->foreign('created_by')->on($usersTableName)->references('id');
                $table->unsignedInteger('updated_by')->nullable();
                $table->foreign('updated_by')->on($usersTableName)->references('id');
                $table->text('properties')->nullable();
                $table->softDeletes();
                $table->timestamps();
            });


        Schema::create('syndicate_fees', function (Blueprint $table) use ($listOfValuesTableName, $usersTableName) {
            $table->id();
            $table->string('type_code')->nullable();
            $table->foreign('type_code')->on($listOfValuesTableName)->references('code')
                ->cascadeOnUpdate()->restrictOnDelete();
            $table->integer('year')->nullable();
            $table->text('details')->nullable();
            $table->float('due')->nullable();
            $table->float('paid')->nullable();

            $table->unsignedBigInteger('related_fee_id')->nullable();
            $table->foreign('related_fee_id')->on('syndicate_fees')->references('id')->onDelete('cascade');

            $table->unsignedInteger('user_id');
            $table->foreign('user_id')->on($usersTableName)->references('id')->onDelete('cascade');
            $table->unsignedInteger('created_by')->nullable();
            $table->foreign('created_by')->on($usersTableName)->references('id');
            $table->unsignedInteger('updated_by')->nullable();
            $table->foreign('updated_by')->on($usersTableName)->references('id');
            $table->text('properties')->nullable();

            $table->softDeletes();
            $table->timestamps();
        });

        Schema::create('syndicate_fee_transactions',
            function (Blueprint $table) use ($listOfValuesTableName, $usersTableName) {
                $table->id();
                $table->string('receipt_no')->nullable();
                $table->date('receipt_date')->nullable();

                $table->float('amount')->nullable();
                $table->text('details')->nullable();
                $table->string('payment_method')->nullable();

                $table->boolean('archived')->default(false);
                $table->unsignedBigInteger('fee_id');
                $table->foreign('fee_id')->on('syndicate_fees')->references('id')->onDelete('cascade');

                $table->string('currency_code')->nullable();
                $table->foreign('currency_code')->on($listOfValuesTableName)->references('code')
                    ->cascadeOnUpdate()->restrictOnDelete();
                $table->unsignedInteger('user_id');
                $table->foreign('user_id')->on($usersTableName)->references('id')->onDelete('cascade');

                $table->string('type_code')->nullable();
                $table->foreign('type_code')->on($listOfValuesTableName)->references('code')
                    ->cascadeOnUpdate()->restrictOnDelete();


                $table->string('transfer_no')->nullable();
                $table->date('transfer_date')->nullable();

                $table->string('cheque_no')->nullable();
                $table->date('cheque_date')->nullable();
                $table->decimal('cheque_amount')->nullable();
                $table->integer('cheque_currency')->nullable();


                $table->unsignedInteger('created_by')->nullable();
                $table->foreign('created_by')->on($usersTableName)->references('id');
                $table->unsignedInteger('updated_by')->nullable();
                $table->foreign('updated_by')->on($usersTableName)->references('id');
                $table->text('properties')->nullable();

                $table->softDeletes();
                $table->timestamps();
            });
        Schema::create('syndicate_exams', function (Blueprint $table) use ($usersTableName) {
            $table->id();
            $table->date('written_date')->nullable();
            $table->date('oral_date')->nullable();

            $table->decimal('written_result')->nullable();
            $table->decimal('oral_result')->nullable();

            // framework
            $table->unsignedInteger('created_by')->nullable();
            $table->foreign('created_by')->on($usersTableName)->references('id');

            $table->unsignedInteger('updated_by')->nullable();
            $table->foreign('updated_by')->on($usersTableName)->references('id');

            $table->unsignedInteger('user_id');
            $table->foreign('user_id')->on($usersTableName)->references('id');

            $table->text('properties')->nullable();

            $table->softDeletes();
            $table->timestamps();
        });

        Schema::create('syndicate_fee_setups',
            function (Blueprint $table) use ($listOfValuesTableName, $usersTableName) {
                $table->id();
                $table->year('year')->nullable();
                $table->float('amount')->nullable();

                $table->string('fee_type')->nullable();
                $table->foreign('fee_type')->on($listOfValuesTableName)->references('code')
                    ->cascadeOnUpdate()->restrictOnDelete();

                $table->string('frequency_type')->nullable();
                $table->foreign('frequency_type')->on($listOfValuesTableName)->references('code')
                    ->cascadeOnUpdate()->restrictOnDelete();

                $table->string('fee_code')->nullable();
                $table->foreign('fee_code')->on($listOfValuesTableName)->references('code')
                    ->cascadeOnUpdate()->restrictOnDelete();

                $table->unsignedInteger('created_by')->nullable();
                $table->foreign('created_by')->on($usersTableName)->references('id');

                $table->unsignedInteger('updated_by')->nullable();
                $table->foreign('updated_by')->on($usersTableName)->references('id');

                $table->text('properties')->nullable();

                $table->softDeletes();
                $table->timestamps();
            });

        Schema::create('syndicate_document_archive',
            function (Blueprint $table) use ($listOfValuesTableName, $usersTableName) {
                $table->id();
                $table->string('classification_code')->nullable();
                $table->foreign('classification_code')->on($listOfValuesTableName)->references('code')
                    ->cascadeOnUpdate()->restrictOnDelete();

                $table->string('type_code')->nullable();
                $table->foreign('type_code')->on($listOfValuesTableName)->references('code')
                    ->cascadeOnUpdate()->restrictOnDelete();

                $table->date('date')->nullable();

                $table->string('document_number')->nullable();
                $table->string('relevant')->nullable();
                $table->string('subject')->nullable();
                $table->string('file_number')->nullable();

                $table->unsignedInteger('created_by')->nullable();
                $table->foreign('created_by')->on($usersTableName)->references('id');

                $table->unsignedInteger('updated_by')->nullable();
                $table->foreign('updated_by')->on($usersTableName)->references('id');

                $table->text('properties')->nullable();

                $table->softDeletes();
                $table->timestamps();
            });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('syndicate_user_academies');
        Schema::dropIfExists('syndicate_user_jobs');
        Schema::dropIfExists('syndicate_pharmacies');
        Schema::dropIfExists('syndicate_trainee_trainings');
        Schema::dropIfExists('syndicate_factories');
        Schema::dropIfExists('syndicate_warehouse_pharmacist');
        Schema::dropIfExists('syndicate_warehouses');
        Schema::dropIfExists('syndicate_loans');
        Schema::dropIfExists('syndicate_insurance_members');
        Schema::dropIfExists('syndicate_beneficiaries');
        Schema::dropIfExists('syndicate_councils');
        Schema::dropIfExists('syndicate_certificate_bans');
        Schema::dropIfExists('syndicate_fees');
        Schema::dropIfExists('syndicate_fee_transactions');
        Schema::dropIfExists('syndicate_exams');
        Schema::dropIfExists('syndicate_fee_setups');
        Schema::dropIfExists('syndicate_document_archive');

        Schema::table('users', function (Blueprint $table) {
            $table->dropForeign('users_city_code_foreign');
            $table->dropForeign('users_district_code_foreign');
            $table->dropForeign('users_status_code_foreign');
            $table->dropForeign('users_gender_code_foreign');
            $table->dropForeign('users_passport_code_foreign');
            $table->dropForeign('users_situation_code_foreign');
            $table->dropForeign('users_archive_code_foreign');
            $table->dropForeign('users_religion_code_foreign');

            $table->dropColumn('city_code');
            $table->dropColumn('district_code');
            $table->dropColumn('gender_code');
            $table->dropColumn('passport_code');
            $table->dropColumn('situation_code');
            $table->dropColumn('archive_code');
            $table->dropColumn('religion_code');
            $table->dropColumn('exam_required');
            $table->dropColumn('second_name');
            $table->dropColumn('third_name');
            $table->dropColumn('death_date');
            $table->dropColumn('id_number');
            $table->dropColumn('relationship_code');
        });
    }
}

Spamworldpro Mini