TypeRocket / typerocket

TypeRocket is a highly integrated MVC WordPress framework with beautiful UI components for the modern developer.
https://typerocket.com
454 stars 62 forks source link

Searching for users and using the search method to link them to cpt #221

Closed avxart closed 5 years ago

avxart commented 5 years ago

Hi there. Following our discussion from Slack.

Current code looks like this:

functions.php $form->Links('Players')->setModel('App\Models\User')

User.php:

class User extends WPUser
{
  use TypeRocket\Models\Traits\Searchable;
}

overridden getSearchColumn(): use TypeRocket\Models\WPUser;

    public function getSearchColumn()
    {
        if($this instanceof WPUser) {
            return 'user_nicename';
        }

        return $this->getIdColumn();
    }
avxart commented 5 years ago

Figured it out. It couldn't find the searchable trait.

Unsure if this happens with other typerocket installs. Since I'm using the theme install.