我有个请求
$marche = March::with('attribution')->get()->where('attribution.date_attribution', '2021');如何格式化'attribution.date_attribution‘只检索一年?
我试了一下parse::parse,但是我得到了以下错误:
Could not parse 'attribution.date_attribution': Failed to parse time string (attribution.date_attribution) at position 0 (a): The timezone could not be found in the database发布于 2021-12-27 08:26:54
未经测试,但您能试试这个吗?
$marche = March::
with('attribution')
->whereHas('attribution', function($query){
$query->whereYear('date_attribution', '2021');
})
->get();发布于 2021-12-27 07:28:42
试着用这个也许:
->whereYear('attribution.date_attribution', '2021')https://laravel.com/docs/8.x/queries#additional-where-clauses
https://stackoverflow.com/questions/70492260
复制相似问题