samedi 30 mars 2019

How to auto list (auto complete) the methods of parent classes and used traits in Sublime for Laravel

Sublime ctrl+space and ctrl+r shortcuts dropdown some methods, but I think I need more. In an example:

Illuminate\Foundation\Auth\User.php

<?php

namespace Illuminate\Foundation\Auth;

use Illuminate\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Foundation\Auth\Access\Authorizable;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;

class User extends Model implements
    AuthenticatableContract,
    AuthorizableContract,
    CanResetPasswordContract
{
    use Authenticatable, Authorizable, CanResetPassword;
}

Laravel's default User model extends above like that:

app/User.php

<?php

namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    use Notifiable;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name', 'email', 'password',
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];
}

Now in the controller I can use User model. And what I want is that when I type User:: and ctrl+"some super shortcut" I expect to see parent-parent class's (e.g. Model) methods like getKeyName() and the methods of Authenticatable, Authorizable, CanResetPassword traits. But typing ctrl+space results in swarms of methods I don't know, and I can't find the desired methods. Should I open parent class files every time?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire