我用的是laravel,我有两个型号 产品 class Product extends Model public function productcategories(){ return $query->where('categoryparent_id', '=', $id);} Product模型有一个作用域Cpscope 我有带函数的<
我使用Scope进行了一些specs2测试 "return world" in new Subject { }trait Subject extends org.specs2.specification.Scope {}def is = s2"""
hello.get should return 'world'
我是Laravel的新手,对如何在我的应用程序中实现搜索功能有一些理解上的问题。 我到目前为止所尝试的。我创建了一个从数据库获取数据的模型(这是有效的) class Post extends Model public static function scopeSearch($query, $searchTerm$searchTerm. '%');} 我的控制器看起来像这样: use App\Post;