route edit button in laravel ajax

Solutions on MaxInterview for route edit button in laravel ajax by the best coders in the world

showing results for - "route edit button in laravel ajax"
Salvatore
03 Apr 2020
1    public function getJobs()
2    {
3        return datatables()->of(Jobs::latest()->get())
4            ->addColumn('action', function ($jobs) {
5                $button = '<div class="btn-group btn-group-xs">';
6                $button .= '<a href="/jobs/' . $jobs->id . '/edit" class="btn btn-primary btn-xs"><i class="fa fa-edit fa-fw"></i> Edit</a>';
7                $button .= '<button type="button" name="deleteButton" id="' . $jobs->id . '" class="btn btn-danger btn-xs deleteButton"><i class="fas fa-trash-alt"></i> Delete</button>';
8                $button .= '</div>';
9                return $button;
10            })
11            ->rawColumns(['action'])
12            ->make(true);
13    }
14
15    public function destroy($id)
16    {
17        Jobs::find($id)->delete();
18    }
19