Creates a new flag for the given user.

@param string $slug
@param string $attribute

@return array Response
543641
public function createNew(
        string $slug,
        string $attribute
    ) : array {

        return $this->sendPost(
            sprintf('/profiles/%s/flags', $this->userName),
            [],
            [
                'slug'      => $slug,
                'attribute' => $attribute
            ]
        );
    }
1047220
protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
    {
        $user = $token->getUser();
        if (!$user instanceof UserInterface) {
            return false;
        }

        return $this->canDelete($subject);
    }
1159533
protected function validateSlug(string $slug, array $config, string $attribute): string
    {
        $separator = $config['separator'];
        $reserved = $config['reserved'];

        if ($reserved === null) {
            return $slug;
        }

        // check for reserved names
        if ($reserved instanceof \Closure) {
            $reserved = $reserved($this->model);
        }

        if (is_array($reserved)) {
            if (in_array($slug, $reserved)) {
                $method = $config['uniqueSuffix'];
                if ($method === null) {
                    $suffix = $this->generateSuffix($slug, $separator, collect($reserved));
                } elseif (is_callable($method)) {
                    $suffix = $method($slug, $separator, collect($reserved));
                } else {
                    throw new \UnexpectedValueException('Sluggable "uniqueSuffix" for ' . get_class($this->model) . ':' . $attribute . ' is not null, or a closure.');
                }

                return $slug . $separator . $suffix;
            }

            return $slug;
        }

        throw new \UnexpectedValueException('Sluggable "reserved" for ' . get_class($this->model) . ':' . $attribute . ' is not null, an array, or a closure that returns null/array.');
    }
782777
protected function executeMigrations($slug, $location)
    {
        if (modules($location)->exists($slug)) {
            $module = modules($location)->where('slug', $slug);
            $pretend = Arr::get($this->option(), 'pretend', false);
            $step = Arr::get($this->option(), 'step', false);
            $path = $this->getMigrationPath($slug);

            $this->migrator->setOutput($this->output)->run($path, ['pretend' => $pretend, 'step' => $step]);

            event($slug.'.module.migrated', [$module, $this->option()]);

            // Finally, if the "seed" option has been given, we will re-run the database
            // seed task to re-populate the database, which is convenient when adding
            // a migration and a seed at the same time, as it is only this command.
            if ($this->option('seed')) {
                $this->call('module:seed', ['module' => $slug, '--force' => true]);
            }
        } else {
            return $this->error('Module does not exist.');
        }
    }
1017469
public function bySlug($slug, $attributes = ['*'])
    {
        $model = $this
            ->findBy('slug', $slug, $attributes);

        if (is_null($model)) {
            abort(404);
        }

        return $model;
    }
399453
protected function make($slug, $arguments = [])
    {
        $sidebar = $this->container->make(Sidebar::class);

        $sidebar
            ->setSlug($slug)
            ->setArguments($arguments)
            ->boot();

        return $this->hang($sidebar);
    }
190787
protected function _createSlug()
    {
        //Regenerate the slug
        if($this->isModified('slug')) {
            $this->slug = $this->_createFilter()->sanitize($this->slug);
        }

        //Handle empty slug
        if(empty($this->slug))
        {
            $slugs = array();
            foreach($this->_columns as $column) {
                $slugs[] = $this->_createFilter()->sanitize($this->$column);
            }

            $this->slug = implode($this->_separator, array_filter($slugs));
        }

        //Canonicalize the slug
        if($this->_unique) {
            $this->_canonicalizeSlug();
        }
    }
260752
public function attachRoleBySlug($slug)
    {
        $role = Role::where('slug', $slug)->first();

        return $this->attachRole($role);
    }
623505
function add($attribute)
    {
        if ($this->contains($attribute->type_uri)) {
            return new Auth_OpenID_AX_Error(
              sprintf("The attribute %s has already been requested",
                      $attribute->type_uri));
        }

        $this->requested_attributes[$attribute->type_uri] = $attribute;

        return true;
    }
1152478
protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
    {
        return $this->supports($attribute, $subject) ? $this->containsRole($token, $subject) : false;
    }
1266485
protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool
    {
        $user = $token->getUser();

        if (!$user instanceof UserInterface) {
            return false;
        }

        $invitation = $subject;

        switch ($attribute) {
            case self::RESPOND:
                return $user->getUsername() == $invitation->getInvitee();
        }
    }
1103085
protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
    {
        if ($this->isSuperAdmin($token)) {
            return true;
        }

        if (!$this->hasRole($token, ContributionRoleInterface::SITE_ADMIN)) {
            return false;
        }

        if (is_string($subject)) {
            return true;
        }

        $user = $token->getUser();
        if ($subject instanceof RedirectionInterface
            || $subject instanceof SiteInterface
        ) {
            return $this->canActOnSite($subject->getSiteId(), $user);
        }

        if ($subject instanceof LogInterface
            || $subject instanceof BlockInterface
        ) {
            return true;
        }

        if ($subject instanceof UserInterface) {
            return $this->voteForUser($subject, $user);
        }

        if ($subject instanceof GroupInterface) {
            return $this->canActOnSite($subject->getSite()->getSiteId(), $user);
        }

        return false;
    }
174109
protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
    {
        if ($this->isSuperAdmin($token)) {
            return true;
        }

        return false;
    }
613536
public static function form($slug, $name = '', array $attributes = []){
        $class_name = get_called_class();
        /** @var AjaxBaseForm $instance */
        $instance = $class_name::get_instance();
        $instance->form_open($attributes);
        $args = $instance->form_arguments();
        $instance->load_template($slug, $name, $args);
        $instance->form_close();
    }
1228126
public function loadFromSlug(string $slug) : BlogAuthor
    {
        $categories = $this->blogAuthorRepo->matching(
            $this->blogAuthorRepo->criteria()
                ->where(BlogAuthor::SLUG, '=', $slug)
        );

        if (!$categories) {
            throw new EntityNotFoundException(BlogAuthor::class, $slug, BlogAuthor::SLUG);
        }

        return reset($categories);
    }
181553
public function fire(Command $console, $slug)
    {
        $this->console = $console;
        $this->slug = strtolower($slug);
        $this->name = Str::studly($slug);

        if ($this->pluggable->exists($this->slug)) {
            $console->comment('Pluggable [{$this->name}] already exists.');

            return false;
        }

        $this->generate($console);
    }
146444
public function voteOnAttribute($attribute, $subject, TokenInterface $token)
    {
        return $this->isOrganizationManager($token, $subject) ? VoterInterface::ACCESS_GRANTED : VoterInterface::ACCESS_DENIED;
    }