Maybe anyone can help me?
This is my controller.
$takegolongan = Pekerjaan::select ('LEFT('golongan_jabatan', 1)')->where('cno', '00001222')->get();
echo $takegolongan;
This is the data that I want to take :
output on the screen (error):
Maybe anyone can help me?
This is my controller.
$takegolongan = Pekerjaan::select ('LEFT('golongan_jabatan', 1)')->where('cno', '00001222')->get();
echo $takegolongan;
This is the data that I want to take :
output on the screen (error):
You can use DB::raw() like this:
use DB;
$takegolongan = Pekerjaan::select(DB::raw('LEFT(`golongan_jabatan`, 1)'))
->where('cno', '00001222')
->get();
You should add single quote inside the double quote or you should use backslash, I can only see the issue of quotes. Like:
$takegolongan = Pekerjaan::select ("LEFT('golongan_jabatan', 1)")->where('cno', '00001222')->get();