PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, January 2, 2022

[FIXED] Column not found: 1054 Unknown column 'orders.deleted_at' in 'where clause'

 January 02, 2022     eloquent, laravel, laravel-5, soft-delete     No comments   

Issue

In my table i don't have deleted_at column.

But in laravel model in return deleted_at is null in where condition.

Below is my code

public function load($id) {

        return $this
            ->select(sprintf('%s.*', $this->getTable()))
            ->where(sprintf('%s.id', $this->getTable(), $this->getKeyName()), '=', $id)
            ->first();
    }

can someone helps me? How to fix this?


Solution

You have to remove the traits use SoftDeletes; from your model file.

and then use below code:

 return $this->where(sprintf('%s.id', $this->getTable(), $this->getKeyName()), '=', $id)
        ->pluck('id');'


Answered By - Madhuri Patel
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing