-
Notifications
You must be signed in to change notification settings - Fork 321
Laravel 5.0 #53
Comments
Comming soon. Stay tuned! |
Hello Dimitious, When are you planning to release it? Just to know, because have a project that I'm migrating to v5.0, and this is one of the packages that I'm waiting for. If there is something that can help, just let me know it. Thank you and best regards, |
Hello folks, I created a laravel 5 branch of this package. Can you try it and tell me how it works? |
Hi, Right now I'm testing it, but I'm dealing with an error "Trait 'Dimsav\Translatable\Translatable' not found". But I keep trying, because I just imported a little portion of my project and maybe is my fault the error. Thank you and Best Regards, |
Sorry, As I installed it from git, had to add the package path to autoload. Now continue testing it. Best Regards and thank you |
Thanks for the info. I will check the autoloading issue and keep you up to date |
Hello, For me it is working very well. I was having another issue, but was related to my key field name that is language_id. But I overwrited it in the model and everything now works fine. Best regards and thank you |
@plmarcelo thanks for the feedback. @nWidart please write here if you have any issues with L5. |
For what I've tested until now:
|
Hi, I did this and it worked fine for me:
Maybe, you have a required field on main table and you are not filling it. Could be? |
Hm I don't think so. I'll give it another shot tonight and give a heads up here. |
Now with this, doing My <?php namespace Modules\Blog\Entities;
use Dimsav\Translatable\Translatable;
use Illuminate\Database\Eloquent\Model;
class Category extends Model
{
use Translatable;
public $translatedAttributes = ['name', 'slug'];
protected $fillable = ['name', 'slug'];
public function posts()
{
return $this->belongsToMany('Post');
}
} My Category translation model: <?php namespace Modules\Blog\Entities;
use Illuminate\Database\Eloquent\Model;
class CategoryTranslation extends Model
{
public $timestamps = false;
protected $fillable = ['name', 'slug'];
} |
You should be having any other problem, I reproduced your models and it works fine for me. What are you tables fields? My Models <?php namespace Gnikoob\Models;
use Dimsav\Translatable\Translatable;
use Illuminate\Database\Eloquent\Model;
/*
Table fields
id INT(11) NOT NULL AUTO_INCREMENT,
*/
class Category extends Model {
use Translatable;
public $translatedAttributes = ['name', 'slug'];
protected $fillable = ['name', 'slug'];
public $timestamps = false;
} Translation model: <?php namespace Gnikoob\Models;
use Illuminate\Database\Eloquent\Model;
/*
Table fields
category_id INT(11) NOT NULL,
locale CHAR(2) NOT NULL,
name VARCHAR(100) NOT NULL,
slug VARCHAR(100) NOT NULL,
*/
class CategoryTranslation extends Model {
protected $fillable = ['name', 'slug'];
public $timestamps = false;
} Route file for testing: Route::get('/', function ()
{
$data = [
'_method' => 'PUT',
'_token' => 'lkasndnfakjsdhnfklaksdmnfaisubdnflajnsdf',
'en' => ['name' => 'Category 2', 'slug' => 'category_2'],
'es' => ['name' => 'Categoría 2', 'slug' => 'categoria_2'],
];
$category = \Gnikoob\Models\Category::create($data);
return $category->translate('en')->name . '(' . $category->translate('en')->slug . ')'; // Category 4
}); The result was this: |
Oh, that's weird...
|
The issue sounds to be related to #38. Can you please compare your mysql versions? |
Laravel 5 is now supported in the development branch. If you have any problems please create a new issue. |
Please add support for Laravel 5.0 :)
The text was updated successfully, but these errors were encountered: