public function test_destroying_should_cascade() { $Property = new Property(array('description' => 'This is a Property')); $Picture = $Property->picture->create(array('title' => 'Front')); $Property->destroy(); $this->assertFalse($this->Property->find('first', array('default' => false))); $this->assertFalse($this->Picture->find('first', array('default' => false))); }
/** * Remove the specified resource from storage. * DELETE /properties/{id} * * @param int $id * @return Response */ public function destroy($id) { $status = Property::destroy($id); return $status ? ['status' => true] : ['status' => false]; }
public function test_clean_up_dependencies() { $Property = new Property('description->', 'Luxury Estate'); $PropertyType = new PropertyType(); $this->assertTrue($PropertyType =& $PropertyType->create(array('description' => 'Mansion'))); $Property->property_type->add($PropertyType); $this->assertTrue($Property->save()); $PropertyType =& $PropertyType->findFirstBy('description', 'Mansion'); $PropertyType->property->load(); $this->assertEqual($PropertyType->properties[0]->getId(), $Property->getId()); $this->assertEqual($PropertyType->property->count(), 1); $this->assertTrue($Property->destroy()); $PropertyType =& $PropertyType->findFirstBy('description', 'Mansion'); $PropertyType->property->load(); $this->assertTrue(empty($PropertyType->properties[0])); $this->assertEqual($PropertyType->property->count(), 0); }
/** * Remove the specified property from storage. * * @param int $id * @return Response */ public function getDestroy($id) { Property::destroy($id); return Redirect::action('PropertiesController@getIndex'); }
/** * Remove the specified kin from storage. * * @param int $id * @return Response */ public function destroy($id) { $property = Property::findOrFail($id); Property::destroy($id); Audit::logaudit('Properties', 'delete', 'deleted: ' . $property->name); return Redirect::route('Properties.index')->withDeleteMessage('Company Property successfully deleted!'); }
public function test_clean_up_dependencies() { $Property = new Property(array('description' => 'Ruins in Matamon')); $this->assertTrue($Property->save()); $South =& $Property->picture->create(array('title' => 'South views')); $this->assertReference($South, $Property->pictures[0]); $this->assertFalse($South->isNewRecord()); $pic_id = $South->getId(); $Property = new Property($Property->getId()); $this->assertTrue($Property->destroy()); $Picture = new Picture(); $this->assertFalse($Picture->find($pic_id)); }