src/Concerns/HasAttributes.php
public function hasWriteAccess($key)
    {
        if (static::$unguarded) {
            return true;
        }

        // Attribute is guarded.
        if (in_array($key, $this->getGuarded())) {
            return false;
        }

        if (($method = $this->getAuthMethod($key)) !== false) {
            return $this->$method($key);
        }

        // Check for the presence of a mutator for the auth operation
        // which simply lets the developers check if the current user
        // has the authority to update this value.
        if ($this->hasAuthAttributeMutator($key)) {
            $method = 'auth'.Str::studly($key).'Attribute';

            return $this->{$method}($key);
        }

        return true;
    }
public function hasWriteAccess($key)
    {
        if (static::$unguarded) {
            return true;
        }

        // Attribute is guarded.
        if (in_array($key, $this->getGuarded())) {
            return false;
        }

        if (($method = $this->getAuthMethod($key)) !== false) {
            return $this->$method($key);
        }

        // Check for the presence of a mutator for the auth operation
        // which simply lets the developers check if the current user
        // has the authority to update this value.
        if ($this->hasAuthAttributeMutator($key)) {
            $method = 'auth'.Str::studly($key).'Attribute';

            return $this->{$method}($key);
        }

        return true;
    }
public function hasWriteAccess ( $ key ) { if ( static :: $ unguarded ) { return true ; } // Attribute is guarded. if ( in_array ( $ key , $ this -> getGuarded ( ) ) ) { return false ; } if ( ( $ method = $ this -> getAuthMethod ( $ key ) ) !== false ) { return $ this -> $ method ( $ key ) ; } // Check for the presence of a mutator for the auth operation // which simply lets the developers check if the current user // has the authority to update this value. if ( $ this -> hasAuthAttributeMutator ( $ key ) ) { $ method = 'auth' . Str :: studly ( $ key ) . 'Attribute' ; return $ this -> { $ method } ( $ key ) ; } return true ; }
Has write access to a given key on this model.

@param string $key

@return bool
Has write access to a given key on this model .