1

Sorry for title. I don't know what to write. This is my problem: If i write this is all ok:

  $obj_license = License::where('licenses.company_id',$company->id)->first();

But this throw an error:

 $license='License';
 $obj_license = $license::where('licenses.company_id',$company->id)->first();

ERROR: Class 'Butchery_license' not found

This is just an example. I really need to have the second way working. There is a solution?

1 Answer 1

1

Try to use full path to a class:

$license='App\License';
$obj_license = $license::where('licenses.company_id',$company->id)->first();
Sign up to request clarification or add additional context in comments.

3 Comments

Right! BUt i do not understand why :|
I'm not PHP guru, I just know that sometimes you should use full path or aliases (use ... as ...) to make it work. So it works now?
Yep, but this works without full path. $obj_license = License::where('licenses.company_id',$company->id)->first(); ..THX :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.