当我创建一个模型时,它最初看起来像这样:
class User extends Eloquent implements UserInterface, RemindableInterface {
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'users';
....
.. etc
问题是,它连接到数据库。我想要一种方法,它跳过了我希望它连接到数据库的事实,而是允许我覆盖这样的函数:
function find($id) {
//insert curl api call to get user id
}
如何做到这一点?
答案 0 :(得分:1)
你可以全部覆盖它们:
class User extends Eloquent implements UserInterface, RemindableInterface {
protected $table = 'users';
public static function find($id, $columns = array('*')) {
//insert curl api call to get user id
return $model;
}
}