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

```
```
return Datatables::of($data)->addColumn('action' , function($data){
    $x='';
    if($data->is_public==0){
        $x.='  <button class="btn btn-inof btn-success">visible</button>';
    }if ($data->is_public==1) {
        $x.='  <button class="btn btn-inof btn-danger**strong text**"> not visible</button>';
    }
     return '
       <button class="btn btn-sm btn-circle btn-danger" 
        id="category_delete_btn" onClick="delete_category('.$data- 
          >id.')"><span class="fa fa-trash "></span></button>

       '.$x.'
     ';
})->make(true);

```