Laravel雄辩地说BadMethodCallException

时间:2017-03-23 01:33:22

标签: laravel eloquent

我有这段代码

class MyCustomException extends Exception {
    Result result;
}

//do you really need switchMap?
.flatMap(result -> {
    if (result.success()) {
        return Observable.just(result.getResource());
    } else {
        return Observable.error(MyCustomException(result));
    }
})
//do* operators is meant to call side effect methods without changing the stream
.doOnError(exception -> { 
    if(exception instanceof MyCustomException) {
        Result result = ((MyCustomException) exception).getResult();
        onFailure(result);
    }
})
.onErrorResumeNext(exception -> {
    if(exception instanceof MyCustomException) {
        return Observable.empty();
    } else {
        return Observable.error(exception); //propagate error downstream
    }
})

我尝试了<?php namespace App\Models; use Reliese\Database\Eloquent\Model as Eloquent; class B2 extends Eloquent { protected $table = 'b2'; protected $primaryKey = 'kip_b1'; public $incrementing = false; public $timestamps = false; protected $fillable = [ 'entried', 'kip_b1' ]; public function user() { return $this->belongsTo(\App\Models\User::class, 'kip_b1', 'username'); } public function scopeEntried($query){ return $query->where('entried',1); } }

php artisan tinker

命令提示符返回

  

BadMethodCallException,带有消息'调用未定义的方法   照亮\数据库\查询\生成器:: entried()'

0 个答案:

没有答案
相关问题