Where clause is not fetching correct data in Laravel EloquentLaravel 4 Eloquent Query Using WHERE with OR AND OR?Laravel Eloquent: Ordering results of all()How to Create Multiple Where Clause Query Using Laravel Eloquent?laravel Eloquent where clauseLaravel Eloquent - distinct() and count() not working properly togetherLaravel. Eloquent queryLaravel Eloquent - Multiple WHERE IN clauseLaravel Eloquent - (where) and (where or where or where)Where query after whereHas not work as it should in Laravel 5.4Laravel 5 Eloquent where clause
What are the benefits of cryosleep?
Different circular sectors as new logo of the International System
Approximate solution : factorial and exponentials
What do different value notes on the same line mean?
Boss wants me to falsify a report. How should I document this unethical demand?
Can't remember the name of this game
I unknowingly submitted plagiarised work
Rename photos to match video titles
Is CD audio quality good enough for the final delivery of music?
Does revoking a certificate result in revocation of its key?
Dictionary size reduces upon increasing one element
Canon 70D often overexposing or underexposing shots
How were these pictures of spacecraft wind tunnel testing taken?
At what point in European history could a government build a printing press given a basic description?
Would the Geas spell work in a dead magic zone once you enter it?
Is there a public standard for 8 and 10 character grid locators?
Is it ok to put a subplot to a story that is never meant to contribute to the development of the main plot?
Is there a way to make it so the cursor is included when I prtscr key?
What is the object moving across the ceiling in this stock footage?
Integrating an absolute function using Mathematica
What is the 中 in ダウンロード中?
What does the view outside my ship traveling at light speed look like?
Identify this in soil?
Can a wire having 610-670 THz (frequency of blue light) A.C frequency supply, generate blue light?
Where clause is not fetching correct data in Laravel Eloquent
Laravel 4 Eloquent Query Using WHERE with OR AND OR?Laravel Eloquent: Ordering results of all()How to Create Multiple Where Clause Query Using Laravel Eloquent?laravel Eloquent where clauseLaravel Eloquent - distinct() and count() not working properly togetherLaravel. Eloquent queryLaravel Eloquent - Multiple WHERE IN clauseLaravel Eloquent - (where) and (where or where or where)Where query after whereHas not work as it should in Laravel 5.4Laravel 5 Eloquent where clause
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I am trying to get all articles which have 'approved' value in status column. Here is the code:
$articles = Article::where('status', 'approved')->orderBy('published_at', 'desc')->get();
But I am getting all data. where clause is not working! Is there anything wrong with the Syntax?
Edit 1:
Here is the what I'm getting for the query:

Edit 2:
Here are the columns I used in table.

laravel laravel-5 eloquent
|
show 3 more comments
I am trying to get all articles which have 'approved' value in status column. Here is the code:
$articles = Article::where('status', 'approved')->orderBy('published_at', 'desc')->get();
But I am getting all data. where clause is not working! Is there anything wrong with the Syntax?
Edit 1:
Here is the what I'm getting for the query:

Edit 2:
Here are the columns I used in table.

laravel laravel-5 eloquent
Your syntax is working fine in my machine. I think your problem is in your datas.
– Md.Sukel Ali
Mar 24 at 6:48
try adding "=" in your where clause like theseArticle::where('status', '=', 'approved')->orderBy('published_at', 'desc')->get();
– escbooster12
Mar 24 at 6:51
@escbooster12 I don't think adding "=" make any difference here ? both give same result.
– Md.Sukel Ali
Mar 24 at 6:54
1
@Md.SukelAli hmm.. my bad sorry. If so, Mosharof Zito try to check in your database if there is really 'approved' data in status column.
– escbooster12
Mar 24 at 6:58
@escbooster12 and Md.Sukel Ali please check the edit of the question. I have added the output in an image.
– Mosharof Zitu
Mar 24 at 7:14
|
show 3 more comments
I am trying to get all articles which have 'approved' value in status column. Here is the code:
$articles = Article::where('status', 'approved')->orderBy('published_at', 'desc')->get();
But I am getting all data. where clause is not working! Is there anything wrong with the Syntax?
Edit 1:
Here is the what I'm getting for the query:

Edit 2:
Here are the columns I used in table.

laravel laravel-5 eloquent
I am trying to get all articles which have 'approved' value in status column. Here is the code:
$articles = Article::where('status', 'approved')->orderBy('published_at', 'desc')->get();
But I am getting all data. where clause is not working! Is there anything wrong with the Syntax?
Edit 1:
Here is the what I'm getting for the query:

Edit 2:
Here are the columns I used in table.

laravel laravel-5 eloquent
laravel laravel-5 eloquent
edited Mar 24 at 9:02
Mosharof Zitu
asked Mar 24 at 6:40
Mosharof ZituMosharof Zitu
2319
2319
Your syntax is working fine in my machine. I think your problem is in your datas.
– Md.Sukel Ali
Mar 24 at 6:48
try adding "=" in your where clause like theseArticle::where('status', '=', 'approved')->orderBy('published_at', 'desc')->get();
– escbooster12
Mar 24 at 6:51
@escbooster12 I don't think adding "=" make any difference here ? both give same result.
– Md.Sukel Ali
Mar 24 at 6:54
1
@Md.SukelAli hmm.. my bad sorry. If so, Mosharof Zito try to check in your database if there is really 'approved' data in status column.
– escbooster12
Mar 24 at 6:58
@escbooster12 and Md.Sukel Ali please check the edit of the question. I have added the output in an image.
– Mosharof Zitu
Mar 24 at 7:14
|
show 3 more comments
Your syntax is working fine in my machine. I think your problem is in your datas.
– Md.Sukel Ali
Mar 24 at 6:48
try adding "=" in your where clause like theseArticle::where('status', '=', 'approved')->orderBy('published_at', 'desc')->get();
– escbooster12
Mar 24 at 6:51
@escbooster12 I don't think adding "=" make any difference here ? both give same result.
– Md.Sukel Ali
Mar 24 at 6:54
1
@Md.SukelAli hmm.. my bad sorry. If so, Mosharof Zito try to check in your database if there is really 'approved' data in status column.
– escbooster12
Mar 24 at 6:58
@escbooster12 and Md.Sukel Ali please check the edit of the question. I have added the output in an image.
– Mosharof Zitu
Mar 24 at 7:14
Your syntax is working fine in my machine. I think your problem is in your datas.
– Md.Sukel Ali
Mar 24 at 6:48
Your syntax is working fine in my machine. I think your problem is in your datas.
– Md.Sukel Ali
Mar 24 at 6:48
try adding "=" in your where clause like these
Article::where('status', '=', 'approved')->orderBy('published_at', 'desc')->get();– escbooster12
Mar 24 at 6:51
try adding "=" in your where clause like these
Article::where('status', '=', 'approved')->orderBy('published_at', 'desc')->get();– escbooster12
Mar 24 at 6:51
@escbooster12 I don't think adding "=" make any difference here ? both give same result.
– Md.Sukel Ali
Mar 24 at 6:54
@escbooster12 I don't think adding "=" make any difference here ? both give same result.
– Md.Sukel Ali
Mar 24 at 6:54
1
1
@Md.SukelAli hmm.. my bad sorry. If so, Mosharof Zito try to check in your database if there is really 'approved' data in status column.
– escbooster12
Mar 24 at 6:58
@Md.SukelAli hmm.. my bad sorry. If so, Mosharof Zito try to check in your database if there is really 'approved' data in status column.
– escbooster12
Mar 24 at 6:58
@escbooster12 and Md.Sukel Ali please check the edit of the question. I have added the output in an image.
– Mosharof Zitu
Mar 24 at 7:14
@escbooster12 and Md.Sukel Ali please check the edit of the question. I have added the output in an image.
– Mosharof Zitu
Mar 24 at 7:14
|
show 3 more comments
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55321335%2fwhere-clause-is-not-fetching-correct-data-in-laravel-eloquent%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55321335%2fwhere-clause-is-not-fetching-correct-data-in-laravel-eloquent%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Your syntax is working fine in my machine. I think your problem is in your datas.
– Md.Sukel Ali
Mar 24 at 6:48
try adding "=" in your where clause like these
Article::where('status', '=', 'approved')->orderBy('published_at', 'desc')->get();– escbooster12
Mar 24 at 6:51
@escbooster12 I don't think adding "=" make any difference here ? both give same result.
– Md.Sukel Ali
Mar 24 at 6:54
1
@Md.SukelAli hmm.. my bad sorry. If so, Mosharof Zito try to check in your database if there is really 'approved' data in status column.
– escbooster12
Mar 24 at 6:58
@escbooster12 and Md.Sukel Ali please check the edit of the question. I have added the output in an image.
– Mosharof Zitu
Mar 24 at 7:14