14-3章节出问题了

来源:14-3 使用全局scope进行软删除模型

慕码人4209688

2018-11-21

老师求救啊
加入了protected static function boot之后就开始报错
注释之后首页可以正常显示
首页无法显示了
图片描述

写回答

2回答

轩脉刃

2018-12-13

// 全局scope的方式
protected static function boot()
{
   parent::boot();

   static::addGlobalScope("avaiable", function(Builder $builder){
       $builder->whereIn('status', [0, 1]);
   });
}

0
0

轩脉刃

2018-12-13

protected static function boot 里面什么代码需要贴一下啊

0
0

Laravel快速开发简书

Laravel最新特性结合Mysql异步消息队列、ElasticSearch搜索引擎、Debugbar调试利器开发简书

1218 学习 · 613 问题

查看课程