/** * @param null $id * @param null $year * @return mixed|\Symfony\Component\HttpFoundation\Response */ public function cashFlow($id = null, $year = null) { if (!$this->gate->check('userCredential', new MinistryTransaction(['ministry_id' => $id]))) { return (new Response())->setContent('Unauthorized')->setStatusCode(401); } return $this->ministryTransaction->getCashFlow($id, $year); }
/** * Updates Denomination * * @param Request $request * @param Gate $gate * @return mixed|\Symfony\Component\HttpFoundation\Response */ public function updateDenomination(Request $request, Gate $gate) { if (!$gate->check('putPostDelete', new IncomeService())) { return (new Response())->setContent('Unauthorized')->setStatusCode(401); } return $this->incomeService->updateDenomination($request->all()); }
/** * Deletes members funds and recalculates total * * @param $incomeServiceId * @param $memberId * @return \Illuminate\Http\JsonResponse */ public function deleteMemberFund($incomeServiceId, $memberId, Response $response, Gate $gate) { if (!$gate->check('putPostDelete', new IncomeServiceMemberFund())) { return $response->setContent('Unauthorized')->setStatusCode(401); } return response()->json($this->dispatch(new DeleteIncomeServiceMemberFundTotal($incomeServiceId, $memberId))); }
/** * 操作権限を取得する * * @param $id * * @return bool */ public function getEntryAbility($id) { return $this->gate->check('update', $this->getEntry($id)); }
function it_accepts_gate_arguments(Gate $gate) { $gate->check('update-post', [1])->shouldBeCalled()->willReturn(true); $this->setGate($gate); $this->check(['allows' => ['update-post', 1]])->shouldReturn(true); }