public function __invoke() : View { $extractShorName = function ($item) { return $item->state->getShortName(); }; $allItems = Item::all(); $newItems = P::pipe(P::filter(P::pipe($extractShorName, P::eq('new'))), 'P::size'); return view('main')->with('items', $allItems)->with('remaining_item_count', $newItems($allItems)); }
public function testEq() { $this->assertEquals(TRUE, P::eq(1, 1)); $this->assertEquals(FALSE, P::eq(1, 2)); }