Question: I've stuck with adding `if` statement on my `addColumn` statement:

```
$inquiries = Inquiry::with('customer')->get();

return Datatables::of($inquiries)
    ->editColumn('created_at', function ($inquiry) {
        return $inquiry->created_at->format('d-m-Y');
    })
    ->editColumn('due_date', function ($inquiry) {
        return Carbon::parse($inquiry->due_date)->format('d-m-Y');
    })
    ->editColumn('status', '@if($status == 0) Pending @elseif($status == 1) Accept @else Cancel @endif')
    ->addColumn('action', function ($inquiry) {
        return '
        <a href="/inquiries/' . $inquiry->id . '" class="btn btn-xs btn-primary"><i class="glyphicon glyphicon-edit"></i> View</a>
        <a href="/inquiries/' . $inquiry->id . '/edit" class="btn btn-xs btn-primary"><i class="glyphicon glyphicon-edit"></i> Edit</a>
        <a href="#" id="delete-button" data-id="' . $inquiry->id . '" class="btn btn-xs btn-primary"><i class="glyphicon glyphicon-edit"></i> Delete</a>
        ';
    })
    ->make(true);

```

I've tried to put `@if @endif` but it appears print it out instead of become a function

I want to show the action button based on status.

Any solution? 

Thanks

Answer: 
Can you do something like the following?

```
->editColumn('status', function ($inquiry) {
    if ($inquiry->status == 0) return 'Pending';
    if ($inquiry->status == 1) return 'Accept';
    return 'Cancel';
})

```
#Simple code to be done#

```
->addColumn('action',function($row){
                $actionBtn='';

                if ($row->status == 'RUNNING') {
                $actionBtn.=
                ' 
                    <a class="btnEdit" href="'.route('purchase.purchaseOrderView',["id"=>$row->id]).'" >
                    <i class="fa-solid fa-money-check-pen fa-xl"></i>
                    </a>
                    &#160
                ';
                }

                $actionBtn.=' 
                    <a data-toggle="modal" class="viewSuppliers" id="'.$row->id.'"  data-target="#modal">
                        <i class="fa-solid fa-eye fa-xl"></i>
                    </a>
                    &#160
                    <a  class="deleteSupplier" id="'.$row->id.'">
                        <i class="fa-solid fa-trash-can-list fa-xl"></i>
                    </a>
                ';
                return $actionBtn;
            })

```