I am using when method for search filtering with this code:
$newitem = DB::table('itemregistrations')
->when(request('umur'), function($query){
$query->whereRaw('YEAR(CURDATE()) - lahir_yy >= ?', [request('umur')]);
})
->when(request('negeri_lahir'), function($query){
$query->where('NegeriID', request('negeri_lahir'));
})
->when(request('kategori'), function($query){
$query->where('CategoryID', request('kategori'));
})
->when(request('pangkat'), function($query){
$query->where('OperasiID', request('pangkat'));
})
->get();
But I need to insert join and select method to get the categoryname and operasiname. but when I insert it to the code, the query error appear.
How to use join and select method in the code?
from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2Akbwiz
via IFTTT
Aucun commentaire:
Enregistrer un commentaire