I'm using dimsav/laravel-translatable
I have two tables Posts and PostTranslations The problem is when i go to localhost/en/posts the image $post->image still there even if $post->title (EN) is null
I want hide the image if $post->title (EN) or other translations are null. please, any help
Schema::create('posts', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('image')->nullable();
$table->unsignedBigInteger('user_id');
$table->foreign('user_id')->references('id')->on('users');
$table->timestamps();
});
Schema::create('post_translations', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('post_id')->unsigned();
$table->string('locale')->index()->nullable();
$table->unique(['post_id','locale']);
$table->foreign('post_id')->references('id')->on('posts')->onDelete('cascade');
$table->string('title')->nullable();
$table->longText('text')->nullable();
$table->string('slug')->unique()->nullable();
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire