Inheritance: extends Eloquen\Eloquent, implements Robbo\Presenter\PresentableInterface
Example #1
0
 /**
  * Configuration of the website
  * @return View
  */
 public function getConfig()
 {
     $languages = TranslationLanguage::lists('name', 'code');
     if (!$this->user->hasAnyAccess(array('config.create', 'config.update'))) {
         App::abort('401');
     }
     $this->layout->title = 'Website Configuration';
     $this->layout->content = View::make($this->link_type . '.' . $this->current_theme . '.config')->with('languages', $languages);
 }
 public function postManage($language_id, $group)
 {
     $language = TranslationLanguage::findOrFail($language_id);
     $input = Input::all();
     unset($input['_token']);
     foreach ($input as $key => $value) {
         $translation = Translation::where('locale', $language->code)->where('key', $key)->first();
         if ($translation) {
             $value = str_replace('**script**', '<script>', $value);
             $value = str_replace('**/script**', '</script>', $value);
             $translation->value = $value;
             $translation->save();
         }
     }
     $this->translation_manager->exportTranslations($group);
     return Redirect::route("{$this->link_type}.modules.doptor.translation_manager.index", [$language_id])->with('success_message', 'The translations were changed.');
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  * @return Response
  */
 public function destroy($id)
 {
     $language = TranslationLanguage::findOrFail($id);
     $language_path = base_path() . '/resources/lang/' . $language->code;
     if (File::exists($language_path)) {
         File::deleteDirectory($language_path);
     }
     // Delete the translations for the language
     Translation::where('locale', $language->code)->delete();
     if ($language->delete()) {
         return Redirect::route("{$this->link_type}.modules.doptor.translation_manager.languages.index")->with('success_message', trans('success_messages.translate_lang_delete'));
     } else {
         return Redirect::route("{$this->link_type}.modules.doptor.translation_manager.languages.index")->with('error_message', trans('error_messages.translate_lang_delete'));
     }
 }