Beispiel #1
0
 /**
  * removing class and schema
  * @param  Request   $request   [description]
  * @param  Classes   $classes   [description]
  * @param  Validator $validator [description]
  * @return void
  */
 public function remove(Request $request, Classes $classes, Validator $validator, Fields $fields, Field_settings $field_settings, Field_groups $groups)
 {
     // validation request
     if ($v = $validator::make($request->all(), $this->removeRules) and $v->fails()) {
         return redirect()->back()->withInput()->withErrors($v->errors());
     }
     $class = $classes->find((int) $request->id);
     $classes->removeSchema($class->shortname);
     $fields->where('class_id', $class->id)->delete();
     $field_settings->where('class_id', $class->id)->delete();
     $groups->where('class_id', $class->id)->delete();
     $class->delete();
     return \Redirect::route('admin.classes.items');
 }
Beispiel #2
0
 public function remove(Request $request, Validator $validator, Fields $fields, Classes $classes, Field_settings $field_settings)
 {
     // validation request
     if ($v = $validator::make($request->all(), $this->removeRules()) and $v->fails()) {
         return redirect()->back()->withInput()->withErrors($v->errors());
     }
     $field = $fields->find((int) $request->id);
     $class = $classes->find($field->class_id);
     // removing field from table
     $field->removeSchema($classes->prefix, $class->shortname, $field->shortname);
     $fields->where('id', $field->id)->delete();
     // remove field
     $field_settings->where('field_id', $field->id)->delete();
     // remove field settings
     $field->delete();
     return \Redirect::route('admin.fields.items', $class->id);
 }