/**
  * Create a new News
  *
  * @param $name
  * @param $slug
  * @param $category
  * @param $title
  * @param $content
  * @param $files
  * @return mixed
  */
 public function create($title, $slug, $category, $content, $files)
 {
     $category = Category::findOrFail($category);
     $news = null;
     try {
         $news = new News();
         $news->category_id = $category->id;
         $news->user_id = \Auth::user()->id;
         $news->slug = $slug;
         $news->save();
         //cria as traduções
         foreach ($content as $iso => $value) {
             $lang = Lang::whereIso($iso)->first();
             $this->translationRepositoryInterface->createKeyValue($lang->id, 'news', $news->id, $value, $title[$iso]);
         }
         //atualiza as imagens
         if (!is_null($files)) {
             foreach ($files as $file) {
                 $this->mediaRepositoryInterface->updateTable($file, 'news', $news->id);
             }
         }
     } catch (\Exception $e) {
         if (!is_null($news) && $news->exists) {
             $this->delete($news->id);
         }
         return false;
     }
     return true;
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $news = new News();
     $news->category_id = 3;
     $news->user_id = 1;
     $news->slug = 'teste-noticia';
     $news->setCreatedAt(\Carbon\Carbon::now());
     $news->setUpdatedAt(\Carbon\Carbon::now());
     $news->save();
     $t1 = new Infrastructure\Models\Translation();
     $t1->lang_id = 1;
     $t1->table = 'news';
     $t1->table_id = $news->id;
     $t1->key = 'Noticia Exemplo';
     $t1->value = 'Corpo noticia exemplo';
     $t1->save();
     $t2 = new Infrastructure\Models\Translation();
     $t2->lang_id = 1;
     $t2->table = 'news';
     $t2->table_id = $news->id;
     $t2->key = 'News Example';
     $t2->value = 'Corpo noticia exemplo';
     $t2->save();
     $t3 = new Infrastructure\Models\Translation();
     $t3->lang_id = 1;
     $t3->table = 'news';
     $t3->table_id = $news->id;
     $t3->key = 'Noticia Ejemplo';
     $t3->value = 'Corpo noticia exemplo';
     $t3->save();
 }