html - 如何从表中选择一行,其模型具有功能

标签 html laravel

class CreditRule extends Model
{
    protected $fillable = array(
        'department_id',
        'created_by',
        'updated_by'
    );

    public function department()
    {
        return $this->belongsTo('App\Department');
    }

我的 Controller 是

 $creditRules = CreditRule::get();

最佳答案

你的意思是类似

CreditRule::find(1);

这将为模型 CreditRule 检索 id=1 的行。

关于html - 如何从表中选择一行,其模型具有功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35693698/

相关文章:

html - 制作HTML嵌套列表的正确方法?

jquery - 输入选择的背景图像

html - 我似乎无法在 css 中编辑图像的宽度和高度

html - 如何使用 Flexbox 居中对齐一个 flex 元素并右对齐另一个 flex 元素

php - 测试以断言选择输入具有特定选项

laravel - Blade CSS View 不反射(reflect)更改

php - 需要关系数的意见

laravel - 可以自动加载或 livereload npm run dev

html - CSS 规则在 IE 中有效,但在 Chrome/Firefox 中无效

javascript - 在另一个选择字段更改后重新填充的动态选择字段 - Laravel 5.2 和 JS