<?php

use App\Models\AgentHero;
use App\Models\AgentHero2;
use App\Models\BankHero1;
use App\Models\BankHowItwork;
use App\Models\BankSection;
use App\Models\BlogHero;
use App\Models\CareerHero;
use App\Models\Category;
use App\Models\ChoosePartner;
use App\Models\ClintReview;
use App\Models\CompanyStateHero;
use App\Models\GuideFaq;
use App\Models\HelpCenter;
use App\Models\HeroThree;
use App\Models\HeroTwo;
use App\Models\HomeCompany;
use App\Models\HomePageHero;
use App\Models\Innovativecomoanies;
use App\Models\MailroomHero;
use App\Models\PartnerHero;
use App\Models\PricHero;
use App\Models\RewardHero;
use App\Models\StartPageSetting;
use App\Models\Tool;
use Illuminate\Support\Facades\File;

if (!function_exists('fileupload')) {

    function fileupload($file, $path)
    {
        // $file = $request->file('image');
        $extenstion = $file->getClientOriginalExtension();
        $filename = time() . '.' . $extenstion;
        $file->move('storage/' . $path . '/', $filename);
        // $student->image = $filename;
        return 'storage/' . $path . '/' . $filename;
    }
    if (!function_exists('home_hero_section')) {
        function home_hero_section()
        {
            return HomePageHero::first();
        }
    }
    function home_page_message()
    {
        $data =  HomePageHero::first();
        $array = explode(",", $data->first_words);
       return $jsonString = json_encode($array);
    }


    if (!function_exists('innovativecomoanies')) {
        function innovativecomoanies()
        {
            return Innovativecomoanies::all();
        }
    }


    if (!function_exists('home_hero_two')) {
        function home_hero_two()
        {
            return HeroTwo::first();
        }
    }
    if (!function_exists('home_hero_three')) {
        function home_hero_three()
        {
            return HeroThree::first();
        }
    }

    if (!function_exists('home_tools')) {
        function home_tools()
        {
            return Tool::all();
        }
    }

    if (!function_exists('home_page_review')) {
        function home_page_review()
        {
            return ClintReview::first();
        }
    }
    if (!function_exists('bank_hero_section')) {
        function bank_hero_section()
        {
            return  BankHero1::first();
        }
    }

    if (!function_exists('bank_how_it_works')) {
        function bank_how_it_works()
        {
            return  BankHowItwork::all();
        }
    }
    if (!function_exists('bank_sections')) {
        function bank_sections()
        {
            return  BankSection::all();
        }
    }

    if (!function_exists('pricing_hero')) {
        function pricing_hero()
        {
            return  PricHero::first();
        }
    }

    if (!function_exists('reward_hero')) {
        function reward_hero()
        {
            return  RewardHero::first();
        }
    }
    if (!function_exists('partner_hero')) {
        function partner_hero()
        {
            return  PartnerHero::first();
        }
    }
    if (!function_exists('choose_partners')) {
        function choose_partners()
        {
            return  ChoosePartner::all();
        }
    }
    if (!function_exists('blog_hero')) {
        function blog_hero()
        {
            return  BlogHero::first();
        }
    }
    if (!function_exists('mail_room_hero')) {
        function mail_room_hero()
        {
            return MailroomHero::first();
        }
    }

    if (!function_exists('agent_hero')) {
        function agent_hero()
        {
            return AgentHero::first();
        }
    }

    if (!function_exists('faq_content')) {
        function faq_content()
        {
            return GuideFaq::first();
        }
    }
    if (!function_exists('companystatehero')) {
        function companystatehero()
        {
            return CompanyStateHero::first();
        }
    }

    if (!function_exists('help_center_contents')) {
        function help_center_contents()
        {
            return HelpCenter::all();
        }
    }
    if (!function_exists('career_hero')) {
        function career_hero()
        {
            return CareerHero::first();
        }
    }

    if (!function_exists('categories')) {
        function categories()
        {
            return Category::all();
        }
    }

    if (!function_exists('homecompany')) {
        function homecompany()
        {
            return HomeCompany::all();
        }
    }
    if (!function_exists('agenthero2')) {
        function agenthero2()
        {
            return AgentHero2::first();
        }
    }

    if (!function_exists('startpageDatas')) {
        function startpageDatas()
        {
            return StartPageSetting::with('startpagesettingdetails')->get();
        }
    }

}
