mercredi 20 avril 2016

Alias Column in Laravel Scope

Here is my Model Scope

public function scopeUser($query, $user_id)
{
    return $query->where('user_id', $user_id)
                ->select(['_id', 'company_name', 'location', 'template_id', 'current_theme_id', 'site_url', 'site_path', 'addons']);
}

What i want is to us theme_id as alias in place of current_theme_id

Tried already searching for solution but all of theme were based on DB queries.

Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire