Support the ongoing development of Laravel.io →
Laravel Eloquent

Hello,

I am currently using the library of Laravel 8 Yajra Datatables (GitHub: https://github.com/yajra/laravel-datatables) to visualize datatables.

Now I have a problem:

When calling the URL a number is sent ($employeeId). This is needed to set the table filter.

The problem is that all records are displayed (without filtering by $employeeId).

Do you see the problem?

Web:

Route::get('employee_course_overview/{employeeId}', [LeatroController::class, 'employeeCoursesOverview'])->name('employeeCourseOverview');

Controller:

public function employeeCoursesOverview(Request $request , $employeeId)
{
    if ($request->ajax()) {

        $data = Leatro::join('employees', 'employees.persnum', '=', 'leatros.employee_id')
            ->where('employees.persnum', $employeeId);

        return Datatables::of($data)
            ->addIndexColumn()
            ->make(true);
    }

    return view('rowdatas.leatros_employee_overview.coursesOverview');
}
Last updated 3 years ago.
0

Sign in to participate in this thread!

PHPverse

Your banner here too?

Veritexx veritexx Joined 19 Jan 2020

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.