php - How to connect another database with model in laravel -
i able connect database this
db::connection('connection_2')->table("users")->get();
but code not working
user::connection('connection_2')->get();
you need set $connection
property of model so:
class mymodel extends eloquent { protected $connection = 'connection_2'; }
Comments
Post a Comment