Disllow delete if parent

This commit is contained in:
snipe
2015-07-28 20:45:32 -07:00
parent 0c9018289b
commit 480fd78c51
2 changed files with 2 additions and 2 deletions

View File

@@ -5,7 +5,7 @@ return array(
'does_not_exist' => 'Location does not exist.',
'assoc_users' => 'This location is currently associated with at least one user and cannot be deleted. Please update your users to no longer reference this location and try again. ',
'assoc_assets' => 'This location is currently associated with at least one asset and cannot be deleted. Please update your assets to no longer reference this location and try again. ',
'assoc_child_loc' => 'This location is currently the parent of at least one asset and cannot be deleted. Please update your locations to no longer reference this location and try again. ',
'assoc_child_loc' => 'This location is currently the parent of at least one child location and cannot be deleted. Please update your locations to no longer reference this location and try again. ',
'create' => array(

View File

@@ -33,7 +33,7 @@ class Location extends Elegant
}
public function childLocations() {
return $this->hasMany('Location','id')->where('parent_id','=',$this->id);
return $this->hasMany('Location','parent_id');
}
public static function getLocationHierarchy($locations, $parent_id = null) {