include a class from a different website in laravel new project - php

I am working on a backend api using laravel 5.6
Already have a website with tons of code - all the answers I found point at create a new folder and adding my classes there that is not an option.
I would like to include the class from the main site (same server) and use the methods within laravel to generate the data from the api.
Route::get('api/author/full/', array('uses' => 'AuthorController#getAuthor'));
I am using this line to include my class:
require_once('/var/www/html/modules/author/models/Author.class.php');
laravel is located in a subfolder at /var/www/html/api/
this is the error I get when i try to require that file from within the AuthorController :
Fatal error: Call to undefined method ErrorException::getStatusCode() in /html/api/app/Exceptions/Handler.php on line 61
Fatal error: Call to undefined method Symfony\Component\Debug\Exception\FatalErrorException::getStatusCode() in /html/api/app/Exceptions/Handler.php on line 61
really tried everything here,included it in public/index.php and in other places and none of these things worked.

Related

Fatal error: Cannot access empty property config.php CAKEPHP

I have a problem with a project in CAKEPHP 3 , the project is form productive and I try to run this project in my XAMMP but display this error:
Fatal error: Cannot access empty property in C:\xampp\htdocs\my_proyect\admin\cake\libs\configure.php on line 91
But, all the kernel files are the ones with the default framework
Thanks

Fatal error: Cannot redeclare route() when running PHPUnit

I got a specific problem with PHPUnit.
I had to write our own route() helper, which I require at the very start of the boot process. It all works fine, because Laravel actually asks if a similar named function already exists whenever generating a helper.
When I try to run tests, I get:
Fatal error: Cannot redeclare route() (previously declared in
E:\laragon\www\fksp\vendor\laravel\framework\src\Illuminate\Foundation\helpers.php:754)
in E:\laragon\www\fksp\app\Http\helpers.php on line 30
And I don't know why. Why does PHPUnit think that the Laravel helper is declared before ours?
I could wrap our function into
if (! function_exists('route')) {}
and it works, but then most likely I will run into problems in the long run with every test that uses the route function?
Any idea or insights how PHPUnit works?

PHP Fatal error: Cannot use "static" when no class scope is active in /vendor/o2syste m/o2glob/src/Helpers/Inflector.php on line 121 - Laravel

I don't know where this error comes from. I just cloned our group Laravel project, then I did composer install, but the result is like this:
PHP Fatal error: Cannot use "static" when no class scope is active in /opt/lampp/htdocs/mxvistore-web/vendor/o2syste
m/o2glob/src/Helpers/Inflector.php on line 121

CodeIgniter Database Session Error

When I try to execute any controller of my CodeIgniter project i receive this error:
Fatal error: Class CI_Session_files_driver contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (SessionHandlerInterface::read) in D:\Git\crud-farm\system\libraries\Session\drivers\Session_files_driver.php on line 49
A PHP Error was encountered
Severity: Error
Message: Class CI_Session_files_driver contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (SessionHandlerInterface::read)
Filename: drivers/Session_files_driver.php
Line Number: 49
Backtrace:
I tried to replace CodeIgniter system files but it didn't work. The problem appears in all projects
Problem solved by restarting Apache.
I attach the url which saved me: http://forum.codeigniter.com/thread-64763.html
In my case i did the following
Restart apache
That's it!
The files in system should not be modified. My files were modified somehow and were throwing error. I resolved my problem as below.
Download fresh codeigniter and extract files
copy system files from fresh codeigniter into your project and overwrite the whole system folder.
This should fix your problem.

My plugin has templates directory , none of them is executing any of the wp functions. All are throwing fatal error : call to undefined function

I am new to wordpress and creating a plugin, an error log has been created automatically in my plugins templates folder which listed so many errors saying -
[22-Dec-2015 07:57:25 Etc/GMT] PHP Fatal error: Call to undefined
function wp_redirect() in
/home/techgwpj/public_html/www.hostrecyclers.com/WP/doctor/wp-content/plugins/tg-doctorin/templates/user-activation.php
on line 12.
When I was doing the same thing from my themes/templates folder this was working fine, but as soon as i placed the same code into my plugins/templates folder it stopped working and a blank page appeared and all the wp functions became undefined
i.e. wp_redirect, get_header(), get_footer() etc

Categories