This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function __call($method, $parameters) | |
{ | |
$this->target->{$method}(...$parameters); | |
return $this->target; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$photos = [ | |
['file_name' => 'wallpaper', 'validated' => true, 'extension' => 'jpg'], | |
['file_name' => 'spring', 'validated' => true, 'extension' => 'png'], | |
['file_name' => 'flowers', 'validated' => false, 'extension' => 'jpg'], | |
['file_name' => 'mac', 'validated' => true, 'extension' => 'png'], | |
['file_name' => 'books', 'validated' => false, 'extension' => 'jpg'], | |
['file_name' => 'mobiles', 'validated' => false, 'extension' => 'jpg'], | |
['file_name' => 'glass', 'validated' => false, 'extension' => 'png'], | |
['file_name' => 'fruit', 'validated' => true, 'extension' => 'jpg'], | |
]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return collect($photos) | |
->where('validated', true) | |
->tap(function ($validated) { | |
return var_dump($validated->pluck('file_name')); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return collect($photos) | |
->where('validated', true) | |
->pipe(function ($validated) { | |
return $validated->where('extension', 'jpg')->pluck('file_name'); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return collect($photos) | |
->where('validated', true) | |
->tap(function ($validated) { | |
return $validated->where('extension', 'jpg')->pluck('file_name'); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0: { | |
file_name: "wallpaper", | |
validated: true, | |
extension: "jpg" | |
}, | |
1: { | |
file_name: "spring", | |
validated: true, | |
extension: "png" | |
}, |
OlderNewer