Permalink
Browse files

add interface

  • Loading branch information...
taylorotwell committed Sep 29, 2017
1 parent 1f37ccc commit be7dccca9f9249c928108d957fe70e78d370d26e
@@ -29,9 +29,10 @@ protected function filter($data)
return $this->merge($data, $index, $this->filter($value->data));
}
if ($value instanceof MissingValue ||
if (($value instanceof PotentiallyMissing && $value->isMissing()) ||
($value instanceof self &&
$value->resource instanceof MissingValue)) {
$value->resource instanceof PotentiallyMissing &&
$value->isMissing())) {
unset($data[$key]);
$index--;
@@ -2,7 +2,15 @@
namespace Illuminate\Http\Resources;
class MissingValue
class MissingValue implements PotentiallyMissing
{
//
/**
* Determine if the object should be considered "missing".
*
* @return bool
*/
public function isMissing()
{
return true;
}
}
@@ -0,0 +1,13 @@
<?php
namespace Illuminate\Http\Resources;
interface PotentiallyMissing
{
/**
* Determine if the object should be considered "missing".
*
* @return bool
*/
public function isMissing();
}

0 comments on commit be7dccc

Please sign in to comment.