public function getEditable($decleration_id, $field_name) { if (!Auth::user() || Auth::user()->role == 100) { Redirect::to('/')->send(); } $editable = Editable::checkIfEditable($decleration_id, $field_name); if ($editable) { Editable::deleteEditable($decleration_id, $field_name); } else { Editable::create(['decleration_id' => $decleration_id, 'field_name' => $field_name]); } return Redirect::Back(); }
public static function deleteEditable($decleration_id, $field_name) { return Editable::where('decleration_id', $decleration_id)->where('field_name', $field_name)->delete(); }