找出(find)背后的源码
打赏作者

gelove

__callStatic 每次都要new一个实例,这不是很坑吗?

JellyBool 回复 gelove

很坑具体是指什么?

gelove 回复 JellyBool

重复创建同样的实例啊

foxriver123 回复 gelove

模型本来就要创建不同的实例,每个实例对应表中一条数据是对的 没问题!!!!!!!!

gelove

‘increment’, 'decrement’是protected方法

gelove

‘increment’, 'decrement’是protected方法

chenze007

我追踪到
public function newQueryWithoutScopes()
{
$builder = $this->newEloquentBuilder(
$this->newBaseQueryBuilder()
);
return builder>setModel(builder->setModel(this)->with($this->with);
}

public function newEloquentBuilder($query)
{
    return new Builder($query);
}

jelly 在这里 new Builder($query); 这里面的 $query是不是 就是 $this->newBaseQueryBuilder() 执行后的返回值
在 Eloquent Builder里面
public function __construct(QueryBuilder $query)
{
$this->query = $query;
}
是这样子的 我查阅手册 说叫依赖注入 想知道 这样写的好处是什么
这里面 传和不传 $query 有什么区别
能详细给说说么 或者我应该看 那些资料给个网址啥的 就是对依赖注入的 好处 和这些源码为啥这样设计之类的

JoouA 回复 chenze007

不错,我在那个纠结了半天 我说return this>where(this->where(this->model->getQualifiedKeyName(), ‘=’, id);中的this->model是啥时候被初始化的,发现有个setModel初始化的$model,但是一直没有找到具体在哪儿调用的setModel.看了你的评论豁然开朗,谢谢

chenze007 回复 JoouA

···
哈哈 无意间帮到你 就很开心
···

taizujunshang

phpstom 显示当前类调用的所有方法的快捷键是什么?

JellyBool 回复 taizujunshang

我这里自定义了 command ctrl m

leyi422 回复 taizujunshang

command f12