yajra / laravel-datatables

jQuery DataTables API for Laravel
https://yajrabox.com/docs/laravel-datatables
MIT License
4.77k stars 858 forks source link

ionCube 503 service unavailable #3095

Closed CyberDepot closed 11 months ago

CyberDepot commented 1 year ago

i use metrinic for my laravel project and finally i want release my product, i use ioncube 12.0.2 for encrypt controllers and models but i have error 503, i trace my app and i found out only on index files have this error and i use DataTable on this functions

Controller

    public function index(BanksDataTable $dataTable){
        return $dataTable->render('basic-information.banks.index');
    }

Yajra DataTable

<?php
namespace App\DataTables;

use App\Core\LIMSHelper;
use App\Models\Bank;
use Yajra\DataTables\EloquentDataTable;
use Yajra\DataTables\Html\Column;
use Yajra\DataTables\Services\DataTable;

class BanksDataTable extends DataTable{
    public function dataTable($query){
        return (new EloquentDataTable($query))
            ->addIndexColumn()
            ->editColumn('created_at', function ($data){
                $date = LIMSHelper::LocalDatePicker($data->created_at, 'Y/m/d H:i');
                return '<span class="ltr d-inline-flex">' . $date . '</span>';
            })
            ->editColumn('updated_at', function ($data){
                $date = LIMSHelper::LocalDatePicker($data->updated_at, 'Y/m/d H:i');
                return '<span class="ltr d-inline-flex">' . $date . '</span>';
            })
            ->addColumn('action', function ($data){
                return $this->actionButtons($data->id);
            })
            ->setRowId('id');
    }

    public function query(Bank $model){
        return $model->business();
    }

    public function html(){
        return $this->builder()
            ->setTableId('banks-table')
            ->columns($this->getColumns())
            ->postAjax();
    }

    protected function getColumns(){
        return [
            Column::make('DT_RowIndex')
                ->orderable(false)
                ->searchable(false)
                ->title(trans('app.table ROW')),

            Column::make('bank_name')
                ->title(trans('app.Bank title'))
                ->addClass('text-start'),

            Column::make('account_holder')
                ->title(trans('app.account number'))
                ->addClass('text-start'),

            Column::make('account_number')
                ->title(trans('app.account holder'))
                ->addClass('none'),

            Column::make('account_card_number')
                ->title(trans('app.card number'))
                ->addClass('none'),

            Column::make('account_iban_number')
                ->title(trans('app.iban number'))
                ->addClass('none'),

            Column::make('created_at')
                ->title(trans('app.created at'))
                ->addClass('nowrap'),

            Column::make('updated_at')
                ->title(trans('app.updated at'))
                ->addClass('nowrap'),

            Column::computed('action', trans('app.action'))
                ->titleAttr('action')
                ->addClass('text-nowrap'),
        ];
    }

    protected function actionButtons($id){
        $edit_url = route('banks.edit', $id);
        $delete_url = route('banks.destroy', $id);

        $edit_caption = trans('app.edit');
        $delete_caption = trans('app.delete');

        $authUser = auth()->user();

        $btn_edit = "<div class='btn btn-light-dark btn-circle mx-1'><i class='fas fa-edit p-0'></i></div>";
        $btn_delete = "<div class='btn btn-light-dark btn-circle mx-1'><i class='fas fa-trash p-0'></i></div>";

        if($authUser->can('edit banks'))
            $btn_edit = "<a href='$edit_url' class='btn btn-primary btn-circle mx-1' data-toggle='tooltip' data-placement='top' title='$edit_caption'><i class='fas fa-edit p-0'></i></a>";

        if($authUser->can('delete banks'))
            $btn_delete = "<a href='$delete_url' class='btn btn-danger btn-circle btn-delete-datatable mx-1' data-toggle='tooltip' data-placement='top' title='$delete_caption'><i class='fas fa-trash p-0'></i></a>";

        return $btn_edit . $btn_delete;
    }

    protected function filename(): string{
        return class_basename($this) . '_' . date('YmdHis');
    }
}

System details

yajra commented 1 year ago

Apologies, I may not be able to help as I haven't tried ionCube yet. Please share if you found the solution. Thanks!

github-actions[bot] commented 11 months ago

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] commented 11 months ago

This issue was closed because it has been inactive for 7 days since being marked as stale.