It should be enough to do
$var = Model::find_by_pk("something");
if($var){
//winning
}else{
//not found
}
The reason you can't do if (count($var->errors) == 0)
is that when you don't get a hit, $var
is not an object so you cannot check the errors
for it.
Mind you that if you do find
you'll get an exception if it doesn't exist, instead of just no result:
try{
$var = Model::find($id);
}catch (\Exception $e){
//not found
}