Posted 5 months ago by chagouani

I have 2 table technicien(id, user_id,actif) and user (nom , prenom , adresse )

I would like to perform a web service function to display the technician list with their name and firstname of the user table

i have this function but it displays all techiciens i like to shown information of selected id

public function GetTables() {
    $techniciens = Technicien::with('user')->get();

    return $techniciens->map(function ($technicien) {
    return [
        'id' => $technicien->id,
        'actif' => $technicien->actif,
        'moyenne_avis' => $technicien->moyenne_avis,
        'nom' => $technicien->user->nom,
        'prenom' => $technicien->user->prenom,
        'adresse' => $technicien->user->adresse,

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

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.