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';
})

```
**Just incase, anyone still looking for :)**

You can do it within your views like this in javascript after defining columns of datatables :

```
   "createdRow": function (row, data) {

          $('td', row).eq('COLUMN_INDEX_HERE').html($('<label>').attr({
              class:  (data.status == 0) ? 'label label-warning' : ( (data.status == 1) ? 'label label-success': 'label label-danger' )
          }).html((data.status == 0) ? 'Pending' : ( (data.status == 1) ? 'Approved': 'Canceled' )));

            }

```