public function test_index_returns_billets_by_get() { Billet::where('id', '>=', 1)->delete(); $billets = factory(Billet::class, 3)->create(); $this->get('api/v1/billet'); $this->seeStatusCode(200); foreach ($billets as $billet) { $this->seeJson(['amount' => $billet->amount]); } }
/** * Get the validation rules that apply to the request. * * @return array */ public function rules() { $id = $this->route('billet'); $billet = Billet::where('id', $id)->first(); return ['amount' => 'required|numeric', 'discount' => 'numeric', 'interest' => 'numeric', 'payment_of_fine' => 'numeric', 'date' => 'date|date_format:Y-m-d', 'refer' => 'required|integer|min:201604|date_format:Ym', 'student_id' => 'in:' . $billet->student_id, 'note' => 'max:65535', 'new_due_date' => 'date|date_format:Y-m-d|after:today', 'statement01' => 'max:30', 'statement02' => 'max:30', 'statement03' => 'max:30', 'statement04' => 'max:30', 'statement05' => 'max:30', 'instruction01' => 'max:30', 'instruction02' => 'max:30', 'instruction03' => 'max:30', 'instruction04' => 'max:30', 'instruction05' => 'max:30', 'acceptance' => 'boolean', 'kind_document' => 'max:3']; }