public function test_index_returns_matters_by_get() { DB::statement('SET FOREIGN_KEY_CHECKS=0;'); Matter::where('id', '>=', 1)->delete(); DB::statement('SET FOREIGN_KEY_CHECKS=1;'); $matters = factory(Matter::class, 3)->create(); $this->get('api/v1/matter'); $this->seeStatusCode(200); foreach ($matters as $matter) { $this->seeJson(['name' => $matter->name]); } }
/** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { $id = $this->route('matter'); return Matter::where('id', $id)->exists(); }
/** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { return Matter::where('id', $this->route('matter_id'))->exists(); }