I have a view.blade.php that calls a wrapper.php that return some value for an iframe in the view.
I'm able to return that value, but I have to do some work with other methods in my laravel classes.
It's possible to instatiate the classes inside the wrapper php and call methods, or call static class methods?
Project structure:
- project
-- app
--- Http
---- Classes
----- RepositoryUtil.php
...
-- public
--- Wrapper.php
...
-- resources
--- views
---- partials
----- view.blade.php
Code inside view.blade.php:
<iframe id="reader" src="/libs/pdfjs/web/viewer.html?file=http://project.dev/Wrapper.php?id={{$encrypted}}">
</iframe>
Code inside Wrapper.php:
<?php
// tried: use App\Http\Classes\RepositoryUtil
// tried: \App\Http\Classes\RepositoryUtil::getValue();
// tried: {{RepositoryUtil::getValue()}}
$myValue = RepositoryUtil::getValue(); #not work
var_dump($myValue);
?>
Code inside RepositoryUtil.php
<?php
class RepositoryUtil{
public static function getValue(){
dd("getValue!");
return "value";
}
}
?>
The error:
( ! ) Fatal error: Class 'RepositoryUtil' not found in /home/vagrant/Code/project/public/Wrapper.php on line 14
EDIT:
I can call static class method adding include_once("../App/Http/Classes/RepositoryUtil.php"); at the top of Wrapper.php but when I call the "laravel methods" like $decrypted = Crypt::decrypt($encrypted); it return the error:
( ! ) Fatal error: Class 'Crypt' not found in /home/vagrant/Code/project/App/Http/Classes/RepositoryUtil.php on line 13
Thanks
