laravel 4 - 一些具有特定连接的模型 - 如何避免重复?

<?php

class Client extends Eloquent {

    protected $table = 'clients';
    private $connection = 'connection2';


    public function getById($id) {
        return DB::connection($this->connection)->table('clients')
            ->select('client_name')
            ->where('id', $id)
            ->first();
    }
}

This model needs to connect to different connection than usuall in this application. At first I was giving connection string to function as parameter, but later decided that its not good to pass same parameter over and over again, when I know that for this model only this connection will be used. Now it is hard coded as private variable.

And there are several such models with same connection. Its ok, but it could be better if this connection setting would be in one place, in case it is changed - so then no need to go though all models which use this and change.

So one thing comes to mind is to have some parent model with this connection and Client model extends from it.

But not sure if that would be good? Maybe you have some other ideas?

Create a seperate class that defines the connection and in the future extend any classes with this class.

use Eloquent;
class Connection2Eloquent extends Eloquent
{
    protected $connection = "connection2";
}

now extend your client with connection2eloquent:

class Client extends Connection2Eloquent
{

}