Guest User

Untitled

a guest
Feb 18th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. <?php
  2.  
  3. class NovelList extends Illuminate\Support\Collection
  4. {
  5.  
  6. public function __construct($items = [])
  7. {
  8. $not_allow_items = array_filter($this->getArrayableItems($items), function ($item){
  9. return !($item === null || $item instanceof Novel);
  10. });
  11.  
  12. if (!empty($not_allow_items)) {
  13. throw new InvalidArgumentException('NovelList required only array of nullable Novel.');
  14. }
  15.  
  16. parent::__construct($items);
  17. }
  18.  
  19. }
Add Comment
Please, Sign In to add comment