protected function parseAuthorization($model, $authorize = [])
    {
        if (!empty($authorize)) {
            // We need to authorize this change

            if (is_string($authorize)) {
                // Only an ability name was given, so use $model
                $authorize = [$authorize, $model];
            }

            list($ability, $authorizeModel) = $authorize;

            $this->authorize($ability, $authorizeModel);
        }
    }
protected function parseAuthorization($model, $authorize = [])
    {
        if (!empty($authorize)) {
            // We need to authorize this change

            if (is_string($authorize)) {
                // Only an ability name was given, so use $model
                $authorize = [$authorize, $model];
            }

            list($ability, $authorizeModel) = $authorize;

            $this->authorize($ability, $authorizeModel);
        }
    }
protected function parseAuthorization ( $ model , $ authorize = [ ] ) { if ( ! empty ( $ authorize ) ) { // We need to authorize this change if ( is_string ( $ authorize ) ) { // Only an ability name was given, so use $model $ authorize = [ $ authorize , $ model ] ; } list ( $ ability , $ authorizeModel ) = $ authorize ; $ this -> authorize ( $ ability , $ authorizeModel ) ; } }
Parse an authorization parameter and authorize if applicable.

@param  Model  $model
@param  array|string  $authorize
@return JsonResponse|Response
Parse an authorization parameter and authorize if applicable .