Reputation: 12327
My question is pretty straight forward. How can I find default methods in laravel 5. For example if im trying to find the default postLogin method
Auth\AuthController@postLogin
What I currently try : go to authcontroller -> look for postlogin cant find it. What is the best way to find default methods?
note: I know it is at
\Illuminate\Foundation\Auth\AuthenticatesUsers
By googling, but how should I find it based on code?
Upvotes: 0
Views: 89
Reputation: 152900
There are two options from where a method can come from when it's not in the actual class file.
I hope you are familiar with the basic concept of inheritance. Classes can extend other classes. So when you see something like this:
class Foo extends Bar
// ^^^^^^^^^^^
Go one level up and check out the Bar
class. Maybe you'll find the method there.
Traits are basically a collection of methods (and properties). A class can include them, like this is the case for the AuthController
class AuthController extends Controller
{
use AuthenticatesAndRegistersUsers, ThrottlesLogins;
AuthenticatesAndRegistersUsers
and ThrottlesLogins
are both traits. If you take a look at AuthenticatesAndRegistersUsers
you can see that it just includes two other traits:
trait AuthenticatesAndRegistersUsers
{
use AuthenticatesUsers, RegistersUsers {
And there you have it. AuthenticatesUsers
.
It helps a lot if you have the right tools for this. Lots IDEs or editors (sometimes a plugin is needed) allow you to click on class names to jump to the actual file.
Another way is to just search for the method name you are looking for in all files. To avoid including usages of the method search like this: function postLogin
Upvotes: 1