samedi 31 août 2019

How to check if translatable are null

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


      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();
            });
     ```

    ``` 
          $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();




from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/30KyLh4
via IFTTT

Aucun commentaire:

Enregistrer un commentaire