Reputation: 223
I'm new working with the Backpack module, I'm trying to make a translatable CRUD following the documentation. But for a unknown case my preview dosen't works as expected. I mean,it saves correctly in the database the information, in different languages, but when you try to edit in an specific langugae or preview it in a specific language it always shows you the first language, that in this case is English.
Im using laravel 8 with backpack 5 and spatie/laravel-translatable "^4.6".
My BBDD:
public function up()
{
Schema::create('blogposts', function (Blueprint $table) {
$table->bigIncrements('id',255);
$table->text('title');
$table->text('body');
$table->enum('status', ['active', 'deactive'])->default('deactive');
$table->timestamps();
});
}
Model:
<?php
namespace App\Models;
use Backpack\CRUD\app\Models\Traits\CrudTrait;
use Illuminate\Database\Eloquent\Model;
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\HasTranslations;
class BlogPost extends Model
{
use CrudTrait;
use HasTranslations;
/*
|--------------------------------------------------------------------------
| GLOBAL VARIABLES
|--------------------------------------------------------------------------
*/
protected $table = 'blogposts';
// protected $primaryKey = 'id';
// public $timestamps = false;
protected $guarded = ['id'];
protected $fillable = ['title', 'body', 'status'];
protected $translatable = ['title', 'body'];
// protected $hidden = [];
// protected $dates = [];
}
As you can see it saves me correctly in the BBDD but when I preview it in a different language it always shos me the english one. Thanks for helping me 😅
Upvotes: 0
Views: 584
Reputation: 1071
Hello there Hello There.
Just to let you know that the bug is fixed, merged and tagged and you should be able to get the fixed version with a composer update backpack/crud
Cheers
Upvotes: 1