I am try to learn how to use this to post properly. I am just starting on Laravel.... recently
Why this is NOT Working?
public function getFunctionFromUserGroup(Request $request)
{
try
{
$abc = $request->get('usertypeid');
return response() -> json(SystemFunction::whereNotIn('Function_ID', function($q){
$q->select('Function_ID')->from('TB_UserAccess')->Where('UserType_ID', $abc );})->get(), 200);
}
catch (\Exception $e)
{
return response(['error'=> $e->getMessage()], 422);
}
}
And Why this is working?
public function getFunctionFromUserGroup(Request $request)
{
try
{
return response() -> json(SystemFunction::whereNotIn('Function_ID', function($q){
$q->select('Function_ID')->from('TB_UserAccess')->Where('UserType_ID', 1);})->get(), 200);
}
catch (\Exception $e)
{
return response(['error'=> $e->getMessage()], 422);
}
}