/**
  * Create translation with key and value
  *
  * @param $lang
  * @param $table
  * @param $id
  * @param $value
  * @param $key
  * @return mixed
  */
 public function createKeyValue($lang, $table, $id, $value, $key)
 {
     $translation = new Translation();
     $translation->lang_id = $lang;
     $translation->table = $table;
     $translation->table_id = $id;
     $translation->value = strtolower($value);
     $translation->key = strtolower($key);
     return $translation->save() ? true : false;
 }
 public function run()
 {
     $categories = [['product', ['pt' => 'rodas', 'en' => 'wheels', 'es' => 'ruedas'], 0], ['product', ['pt' => 'estrada', 'en' => 'road', 'es' => 'carretera'], 1], ['news', ['pt' => 'geral', 'en' => 'main', 'es' => 'general'], 0], ['spec', ['pt' => 'tecnologias', 'en' => 'technologies', 'es' => 'tecnologias'], 0]];
     foreach ($categories as $category) {
         $c = new Category();
         $c->parent_id = $category[2];
         $c->type = $category[0];
         $c->save();
         foreach ($category[1] as $lang => $value) {
             $lang_id = Lang::whereIso($lang)->first()->id;
             $t = new Translation();
             $t->lang_id = $lang_id;
             $t->table = 'categories';
             $t->table_id = $c->id;
             $t->value = $value;
             $t->save();
         }
     }
 }