laravel 5.2 return datatables and assign db field value before passing to blade
<p>i have a function will return a datatables json, but the $type need to be set before passing to blade. I want to assign the each row result 'type' to $type, how can i do that? It needs to assign first so the blade can translate the value.</p>

<pre><code>public function data() {

    $vendor_id = $this-&gt;getVendorId ();

    $menu = Menu::with('meal')-&gt;find($vendor_id);
    $meal = $menu-&gt;meal;


    return Datatables::of($meal)
    -&gt; edit_column('type', '{{trans(\'admin/meal.'.$type.'\')}}')
    //-&gt; edit_column('type', '&lt;a href="#" &gt;'.trans('admin/meal.' . $type).'&lt;/a&gt;')
    -&gt; edit_column('name', '&lt;a href="{{{ URL::to(\'admin/project/\' . $id ) }}}" &gt;{{$name}}&lt;/a&gt;')
    -&gt; add_column('actions', '&lt;a href="{{{ URL::to(\'admin/meal/\' . $id . \'/edit\' ) }}}" class="btn btn-success btn-sm iframe" &gt;&lt;span class="glyphicon glyphicon-pencil"&gt;&lt;/span&gt;  {{ Lang::get("admin/modal.edit") }}&lt;/a&gt;
                &lt;a href="{{{ URL::to(\'admin/meal/\' . $id . \'/delete\' ) }}}" class="btn btn-sm btn-danger iframe"&gt;&lt;span class="glyphicon glyphicon-trash"&gt;&lt;/span&gt; {{ Lang::get("admin/modal.delete") }}&lt;/a&gt;
                &lt;input type="hidden" name="row" value="{{$id}}" id="row"&gt;')

    -&gt; remove_column('id')
    -&gt; remove_column('created_at')
    -&gt; remove_column('vendor_id')       
    -&gt; make();


}
</code></pre>