Eloquent model returns 0 as primary key
You can try setting public $incrementing = false; on your model so eloquent doesn’t expect your primary key to be an autoincrement primary key.
You can try setting public $incrementing = false; on your model so eloquent doesn’t expect your primary key to be an autoincrement primary key.
I had to deal with a similar problem. The solution provided by @fab won’t work with eager loading because $this->source_file would be null at the time the relationship is processed. I came up with this solution After installing Compoships and configuring it in your models, you can define your relationships matching multiple columns. The owning … Read more
Use like and not like with % in where() and orWhere() methods: ->where(‘column’, ‘like’, ‘%pattern%’) https://laravel.com/docs/5.3/queries#where-clauses If you need to use multiple AND do like this: ->where($condition) ->where($anotherCondition) If you want to use OR do this: ->where($condition) ->orWhere($anotherCondition) To combine multiple AND and OR do parameter grouping: ->where(‘name’, ‘=’, ‘John’) ->orWhere(function ($query) { $query->where(‘votes’, ‘>’, … Read more