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/mcoil.corals.io/app/Shop/Businesses/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/mcoil.corals.io/app/Shop/Businesses/Business.php
<?php

namespace App\Shop\Businesses;

use App\Shop\Rrps\Rrp;
use App\Shop\Customers\Customer;
use App\Shop\PriceTypes\PriceType;
use App\Shop\Quotations\Quotation;
use Illuminate\Database\Eloquent\Model;
use App\Shop\AccountManagers\AccountManager;
use Nicolaslopezj\Searchable\SearchableTrait;

class Business extends Model
{
    use SearchableTrait;
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'title',
        'description',
        'address1',
        'address2',
        'area',
        'country',
        'telephone',
        'email',
        'website',
        'contacts',
        'account_manager_id',
        'price_types_id',
        'account_number',
        'rrp_id',
        'discount',
        'price_types_id',
        'image'
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [];

    protected $casts = [
        'contacts' => 'array'
    ];
    /**
     * Searchable rules.
     *
     * @var array
     */
    protected $searchable = [
        'columns' => [
            'title' => 5,
            'account_manager_id' => 10 ,
            'area' => 10,
            'email' => 5,
            'telephone' => 5
        ]
    ];

    public function rrp()
    {
        return $this->belongsTo(Rrp::class);
    }

    /**
     * @param $term
     *
     * @return mixed
     */
    public function searchBusiness($term)
    {
        return self::search($term);
    }


    /**
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function priceType()
    {
        return $this->belongsTo(PriceType::class);
    }

    public function accountManager()
    {
        return $this->belongsTo(AccountManager::class, 'account_manager_id');
    }


    public function customers()
    {
        return $this->hasMany(Customer::class);
    }

    public function quotations()
    {
        return $this->hasMany(Quotation::class);
    }

    public function getArrayContactAttribute()
    {
        if(is_array($this->contacts)) {
            foreach($this->contacts as $contact) {
                if( !is_null($contact['name']) ) {
                    $contacts[$contact['id']] = $contact['name'];
                }
            }
        }
        return $contacts;
    }
}

Spamworldpro Mini