Disllow delete if parent
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user