Laravel 5.2.45 Where is the Auth Controller and model? - php

Where are the "out-of-the-box" Authentication Controllers and Models for Laravel 5.2.45? I've searched thoroughly and I keep seeing it's in app/http/auth but only HomeController and a minimal Controller.php is there.
Also, It's a fresh install with only minimal edits such as new files to views and assets such as css and js. I used "php artisan make:auth" and the output only stated the new view files.
I'm learning Laravel to replace Codeigniter and this is a stump I've stumbled upon.

The model files are stored directly inside the app directory.
The controller files are stored inside app/Http/Controllers directory. Auth Controller is inside app/Http/Controllers/Auth.
By the way in the mentioned version of laravel no HomeController file is generated by laravel.

Related

How Laravel Generate Model Migration Controller all command related files?

after these commands
php artisan make:model 'FileName' -mcs
Laravel make command files sources (Model, Controller, Migration, Seeder, Factory etc...)
How all basic files generate and where from these files comes?
All the generated stuff in Laravel use templates
If you run artisan command in your console, you can observe that exists a section called stub, and the only command in this section is php artisan stub:publish.
If you run that command it will generate a new folder inn your app root folder called stubs with a bunch of files inside all with extension .stub.
You can open those files and modify then or customize them as needed. From now on this folder will be the place from where your Laravel app will read the template for making all kind of stuff that artisan usually does.
This templates are included with every Laravel installation and is totally optional publish them or not. In fact there are many packages dedicated to make custom Controllers or Models like this one from Spatie
The internals above this generators
Laravel has two kernels,
The first one in app/Console/kernel
The second one in app/Http/kernel
When you run artisan, Laravel Bootstrap the app, and run the Kernel console. This both Kernels has different purposes, really they function as separates apps.
About the specific generation of the above files, I mean different controllers, Models, migrations etc.. all that stuff related to models are generated by one Class.
class ModelMakeCommand extends GeneratorCommand{ .... }
Which is located under Illuminate\Foundation\Console namespace.
You can check the code of that class and see how the stubs files are used to generate the variety of commands only related to Models, but there are many more, like Policies, Events, Jobs etc...
I hope this helps and answer your question
Here you are more information about this subject from Laravel News
These files are being generated from stub files. Here are some stubs directory location on any laravel project. you can check this out.
For Model :
vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/model.stub
Others :
vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs
vendor/laravel/framework/src/Illuminate/Routing/Console/stubs
vendor/laravel/framework/src/Illuminate/Database/Console/Factories/stubs
vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/stubs
if you want control over these stubs you have to apply below command
php artisan stub:publish
this command will publish stub files on "stubs" folder on your project directory. Then you can customize according to your need.

RegistersUsers trait in Laravel 7.2

I want to override core registration functionality in Laravel 7.23.2. According to this source I need to override the register() function, which belongs to the trait 'RegistersUsers' and is located in vendor/laravel/framework/src/Illuminate/Foundation/Auth/
However, in this folder all I see is User.php and "Access" folder which does not have the aforementioned trait as well. I've searched the entire vendor folder and there is no file RegistersUsers.php. In GitHub of Laravel Framework 7.x, there is no such file as well.
But I can see one in Laravel 5.5. So I assume registration method resides somewhere else.
So basically my two questions:
In registration controller there is a line use RegistersUsers;
If there is no RegistersUsers.php, then what is being used here?
This will probably be answered by the first one, but where I can find the core implementation of register() method?
This was moved out of the core and is part of the laravel/ui package. So the file would be in vendor/laravel/ui/auth-backend/.
You can open that and see the register method, but you may not have to override it. That method calls other methods that you can override as well. Some of these methods are only there basically so you can override them so you don't have to override the entire Registration system.

Folder Controllers created empty

I used Symfony version v4.4.1 . I create project in CLI using symfony command:
symfony new my_project_name --full
But my folder in src/Controller is empty, please, help.
Maybe my Controllers are created in another directory. On screenshot, you can see trouble.
Early, it's working nice.
When you create a new application Controller directory is empty. It's a normal result when you use the full argument. Full will only specified that you have all common utilities/libraries (twig, security, etc). But you have to create your own business (entities, controllers, forms, views, etc).
If you want to create a Controller, you should install the maker bundle
symfony composer req maker --dev
Then the console will be able to create Controller as easy as:
symfony console make:controller MyNewController
Default controller is no longer in the empty application, because some applications do not need them. As example, if you are developing an API, you do not use controller. Another example, some developers do not use MVC(model view controller) pattern but the ADR (Action Domain Responder) Pattern

Using Auth::user(); in core php

I'm working on a project , the problem is that some part of the project is made in laravel and some part in core php . Now i want to perform authentication through Auth Facade for my project . Some files are being accessed through routes and some files which are in core php are being accessed directly . so the files which are being accessed through routes Auth is working perfect But what to do for core php files , i don't want to use $_SESSION. Please suggest me a way to use Auth in my core php files.
You can include autoload.php in your core files and then you can try to get laravel functions as we do in WordPress codex.

Laravel cannot load the specific User model

I have just uploaded a Laravel 4.1 application to Bluehost, and since I cannot login into my app, it keeps telling me that my User class doesn't exist.
I'm using psr-4 to load my specific dir/namespace and inside that I have created my own User class under the model dir.
I have also changed the auth.config file pointing the User model in the specific dir.
I checked the composer autoload_classmap which keeps loading the original app/model/User class. I don't know if this is incorrect since it is the same in my local dev ambient.
Here's the funny thing. Only the User model doesn't work, the others, declared in the same namespace are working as expected.
Looks like Laravel doesn't consider the auth.config file.
Someone can give a hand with this?

Categories