Theory
The problem lies in the namespaces, when Laravel gives an error of:
Class 'app\Http\Controllers\Controller' not found
It's often a mistake that en route is incorrectly redirecting the call to where it has to go.
The namespaces in Laravel are very important they are a standard from the PSR4 , where they comment, together with the PSR2 .
Laravel follows the PSR-2 coding standard and the PSR-4 autoloading
standard.
Source
Solution
namespace App\Http\Controllers;
class ContactoController extends Controller
{
public function inicio()
{
return "esto es un controlador";
}
}
Your error is in:
namespace cinema\Http\Controllers;
Logically if Laravel starts in App \ Http \ Controllers, the cinema does not pick it up.
I advise you to use the artisan from Laravel, which is a way that builds all the models and controllers in a standard way, as you want them to be used, with time you will notice how it is done and you will not need the command, the command would be:
php artisan make:[model|controller] --resource Evento
php artisan make:controller --resource ContactoController
Link | Official Source
- - resource what it does is create all the standard headers that Laravel uses.
This you have to run in the root directory where you have installed laravel, which is one level below the App folder that is where the Namespaces starts to write the address where they are.
Curiosity
I'll put some notes for you to know the reason of the namespaces:
The namespaces are necessary so that there is no clash between the classes, for example if you have two classes called as in your case ContactController, then you have unnecessary crebaderos head.
Another reason is to define in a perfect way where each class is located, for when you make a use, in the code you do it to the class you want.
PD
I hope I have helped, through this response and do not hesitate to ask, we do not all know everything, but we all know it.