コード例 #1
0
 function it_should_skip_defaults_when_requested()
 {
     $this->get('baz')->shouldReturn(3);
     Transformer::preferNullValues();
     $this->get('baz')->shouldReturn(null);
     $this->all()->shouldEqual(['foo' => -1, 'bar' => 2, 'baz' => null]);
     Transformer::preferNullValues(false);
     $this->get('baz')->shouldReturn(3);
     $this->all()->shouldEqual(['foo' => -1, 'bar' => 2, 'baz' => 3]);
 }
コード例 #2
0
 /**
  * Filter request input by a policy function that provides a whitelist of
  * attribute names based on a user's privilege over the $record for the
  * $action specified.
  *
  * @api
  * @see self::authorizerAttributes()
  * @param  mixed $record
  * @param  string|null $action
  * @return array
  */
 public function permittedAttributes($record, $action = null)
 {
     $whitelist = (new Authorizer())->permittedAttributes($this->authorizerUser(), $record, $action);
     $attributes = new Transformer($this->authorizerAttributes());
     return $attributes->only($whitelist);
 }