1 week ago

Action button in Laravel Yajra

Posted 1 week ago by saadaan


I am trying to use action buttons in laravel yajra, but needing some help. Following is the old syntax I used in blade syntax:

<td align="center"><a href="viewformdetails/{{$form->id}}"><button class="btn btn-success btn-xs" type="button">Click to View Details</button

I cannot seem to make it work in Yajra in the controller:

       return datatables()->of(Form::where('area', 'local')
                                    ->where('submission_type', '=', 'official')
                                    ->orderBy('id', 'DESC')->get()
                            ->addColumn('details', function($row){
                                   $btn = '<a href="viewformdetails/{{$form->id}}" class="btn btn-success btn-xs">Form Details</a>';
                                    return $btn;

The controller does not properly work on $form->id parameter.

How to pass this parameter to the button?

Thanks, Saad

Please sign in or create an account to participate in this conversation.