【发布时间】:2019-11-27 10:54:40
【问题描述】:
试图用 eloquent 做一个多重选择语句。
使用Blog::where()
... 函数,并在其中包含一个数组。
$matchThese = ['title' => post('title'), 'slug' => post('slug')];
return Blog::where($matchThese)->get();
在测试时,即使输入匹配,它也会返回一个空值,数据库表名正确写入
Model 扩展了 October CMS 模型,因此 laravel 中的所有 eloquent 方法都包含在内。博客模型如下
<?php namespace Andre\Blogroutes\Models;
use Model;
use ModelNotFoundException;
class Blog extends Model
{
use \October\Rain\Database\Traits\Validation;
public $table = 'blog';
}
【问题讨论】:
-
请展示您的博客模型
-
请在您的帖子中更新。不在评论中
-
在下面查看我的答案,如果您还有问题,请告诉我?
标签: laravel-5 eloquent octobercms