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




via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire