protected function sanitize($preferences = null) : Collection
	{
		if (is_null($preferences) && $this->auth->check()) {
			return Collection::make($this->auth->user()->preferences);
		}

		if (is_null($preferences) && ! $this->auth->check()) {
			return $this->allowed;
		}

		if (is_string($preferences)) {
			$preferences = json_decode($preferences, true);
		}

		return Collection::make($preferences)->filter(function($item, $key) {
			return $this->allowed->has($key);
		});
	}
protected function sanitize($preferences = null) : Collection
	{
		if (is_null($preferences) && $this->auth->check()) {
			return Collection::make($this->auth->user()->preferences);
		}

		if (is_null($preferences) && ! $this->auth->check()) {
			return $this->allowed;
		}

		if (is_string($preferences)) {
			$preferences = json_decode($preferences, true);
		}

		return Collection::make($preferences)->filter(function($item, $key) {
			return $this->allowed->has($key);
		});
	}
protected function sanitize ( $ preferences = null ) : Collection { if ( is_null ( $ preferences ) && $ this -> auth -> check ( ) ) { return Collection :: make ( $ this -> auth -> user ( ) -> preferences ) ; } if ( is_null ( $ preferences ) && ! $ this -> auth -> check ( ) ) { return $ this -> allowed ; } if ( is_string ( $ preferences ) ) { $ preferences = json_decode ( $ preferences , true ) ; } return Collection :: make ( $ preferences ) -> filter ( function ( $ item , $ key ) { return $ this -> allowed -> has ( $ key ) ; } ) ; }
Sanitizes the given preferences.

@param  null|string $preferences

@return Collection
Sanitizes the given preferences .