Joomla use slug instead of ID in component URL

14 Views Asked by At

I made an component that displays jobs on my website.
The detail view of a job works based on the ID (also in the URL /job/52)

I would like to use a slug for each job instead (/job/manager-ict).

I have no Idea where to look and what to change without modifying for other components.

Can someone help me?
The data is also received from a database table:

public function __construct(DatabaseDriver $db)
{
    $this->typeAlias = 'com_jobs.job';
    parent::__construct('#__jobs_jobs', 'id', $db);
    $this->setColumnAlias('published', 'state');
    
}

I tried modifying id into slug, but that didnt work.
parent::__construct('#__jobs_jobs', 'id', $db);
Modifying it into job_id (an other id) works fine.

0

There are 0 best solutions below