samedi 15 décembre 2018

Using AS Keyword in Laravel Eloquent Main Model

I want to use AS keyword in Laravel Eloquent Models like that:

Here my sample query:

User::find(1)
    ->select("name", "age")
    ->join("profile as p", "p.user_id", "=", "users.id")
    ->orderBy("name", "asc")
    ->get();

Expected usage u.id instead of users.id on joins with main table/model

->join("profile as p", "p.user_id", "=", "u.id")

Is there such a feature, is it possible?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire