App\Ninja\Datatables\InvoiceDatatable::actions PHP Method

actions() public method

public actions ( )
    public function actions()
    {
        $entityType = $this->entityType;
        return [[trans("texts.edit_{$entityType}"), function ($model) use($entityType) {
            return URL::to("{$entityType}s/{$model->public_id}/edit");
        }, function ($model) {
            return Auth::user()->can('editByOwner', [ENTITY_INVOICE, $model->user_id]);
        }], [trans("texts.clone_{$entityType}"), function ($model) use($entityType) {
            return URL::to("{$entityType}s/{$model->public_id}/clone");
        }, function ($model) {
            return Auth::user()->can('create', ENTITY_INVOICE);
        }], [trans('texts.view_history'), function ($model) use($entityType) {
            return URL::to("{$entityType}s/{$entityType}_history/{$model->public_id}");
        }], ['--divider--', function () {
            return false;
        }, function ($model) {
            return Auth::user()->can('editByOwner', [ENTITY_INVOICE, $model->user_id]) || Auth::user()->can('create', ENTITY_PAYMENT);
        }], [trans('texts.mark_sent'), function ($model) {
            return "javascript:markEntity({$model->public_id})";
        }, function ($model) {
            return $model->invoice_status_id < INVOICE_STATUS_SENT && Auth::user()->can('editByOwner', [ENTITY_INVOICE, $model->user_id]);
        }], [trans('texts.enter_payment'), function ($model) {
            return URL::to("payments/create/{$model->client_public_id}/{$model->public_id}");
        }, function ($model) use($entityType) {
            return $entityType == ENTITY_INVOICE && $model->balance > 0 && Auth::user()->can('create', ENTITY_PAYMENT);
        }], [trans('texts.view_quote'), function ($model) {
            return URL::to("quotes/{$model->quote_id}/edit");
        }, function ($model) use($entityType) {
            return $entityType == ENTITY_INVOICE && $model->quote_id && Auth::user()->can('editByOwner', [ENTITY_INVOICE, $model->user_id]);
        }], [trans('texts.view_invoice'), function ($model) {
            return URL::to("invoices/{$model->quote_invoice_id}/edit");
        }, function ($model) use($entityType) {
            return $entityType == ENTITY_QUOTE && $model->quote_invoice_id && Auth::user()->can('editByOwner', [ENTITY_INVOICE, $model->user_id]);
        }], [trans('texts.convert_to_invoice'), function ($model) {
            return "javascript:convertEntity({$model->public_id})";
        }, function ($model) use($entityType) {
            return $entityType == ENTITY_QUOTE && !$model->quote_invoice_id && Auth::user()->can('editByOwner', [ENTITY_INVOICE, $model->user_id]);
        }]];
    }