Skip to content

Commit

Permalink
Changes for working with laravel 5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Stoimenov committed Jul 13, 2016
1 parent 816a52e commit a66ded2
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
20 changes: 9 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,21 @@
"description": "Database localization package for laravel framework",
"keywords": ["framework", "laravel", "despark", "localization", "database"],
"license": "MIT",
"authors": [
{
"name": "Tihomir Banov",
"email": "[email protected]"
}
],
"authors": [{
"name": "Tihomir Banov",
"email": "[email protected]"
}],
"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": {
"Despark\\LaravelDbLocalization\\": "src/"
}
},
"minimum-stability": "stable"
}
}
8 changes: 4 additions & 4 deletions src/i18nModelTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
}

Expand Down
2 changes: 2 additions & 0 deletions src/migrations/2015_04_28_100423_create_i18n_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/models/I18n.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ class I18n extends Eloquent

protected $rules = [
'locale' => 'required',
'name' => 'required',
'name' => 'required',
];
}

0 comments on commit a66ded2

Please sign in to comment.