diff --git a/composer.json b/composer.json index 51c49ee..027e861 100755 --- a/composer.json +++ b/composer.json @@ -3,18 +3,16 @@ "description": "Database localization package for laravel framework", "keywords": ["framework", "laravel", "despark", "localization", "database"], "license": "MIT", - "authors": [ - { - "name": "Tihomir Banov", - "email": "tbanov@despark.com" - } - ], + "authors": [{ + "name": "Tihomir Banov", + "email": "tbanov@despark.com" + }], "require": { "php": ">=5.4.0", - "illuminate/auth": "5.1.*", - "illuminate/support": "5.1.*", - "illuminate/routing": "5.1.*", - "illuminate/database": "5.1.*" + "illuminate/auth": "^5.1", + "illuminate/support": "^5.1", + "illuminate/routing": "^5.1", + "illuminate/database": "^5.1" }, "autoload": { "psr-4": { @@ -22,4 +20,4 @@ } }, "minimum-stability": "stable" -} \ No newline at end of file +} diff --git a/src/i18nModelTrait.php b/src/i18nModelTrait.php index c48f91a..4c08f50 100755 --- a/src/i18nModelTrait.php +++ b/src/i18nModelTrait.php @@ -95,7 +95,7 @@ public function getI18nId($locale = null) public function translate($locale = false, $alowRevision = false) { $translation = null; - $translationModel = new $this->translator(); + $translationModel = new $this->translator(); if (!is_int($locale)) { $locale = $this->getI18nId($locale); @@ -133,7 +133,7 @@ public function scopeWithTranslations($query, $locale = null, $softDelete = null $translatorField = $this->getTranslatorField(); $localeField = $this->getLocaleField(); - if (! $locale) { + if (!$locale) { $query = $query->leftJoin( $translatorTableName, $translatorTableName.'.'.$translatorField, '=', $translatableTable.'.id'); @@ -170,7 +170,7 @@ public function scopeWithTranslations($query, $locale = null, $softDelete = null public function save(array $options = []) { if (empty($options)) { - $options = \Input::all(); + $options = \Request::all(); } parent::save($options); @@ -225,7 +225,7 @@ public function saveTranslations($translatableId, $options) $result = $query->first(); if (!isset($result->id)) { - if (! isset($translation->id)) { + if (!isset($translation->id)) { $translation = new $modelName(); } diff --git a/src/migrations/2015_04_28_100423_create_i18n_table.php b/src/migrations/2015_04_28_100423_create_i18n_table.php index 325bb77..714b610 100755 --- a/src/migrations/2015_04_28_100423_create_i18n_table.php +++ b/src/migrations/2015_04_28_100423_create_i18n_table.php @@ -12,8 +12,10 @@ public function up() { Schema::create('i18n', function (Blueprint $table) { $table->increments('id'); + $table->string('locale')->unique()->index(); $table->string('name')->index(); + $table->timestamps(); }); } diff --git a/src/models/I18n.php b/src/models/I18n.php index 275eb05..36163da 100755 --- a/src/models/I18n.php +++ b/src/models/I18n.php @@ -15,6 +15,6 @@ class I18n extends Eloquent protected $rules = [ 'locale' => 'required', - 'name' => 'required', + 'name' => 'required', ]; }