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

Sunday, February 20, 2022

[FIXED] how to get wehere variable data laravel

 February 20, 2022     laravel, laravel-8, php     No comments   

Issue

$data = Models::all();
$new_data = $data::where('category','tree')->get();
return view('backend.view',compact('data','new_data));

can i make $data to type data by other categories?

Error Using $this when not in object context


Solution

try this

$data = Models::all();
$new_data = $data->where('category','tree');


Answered By - Bhargav Rangani
  • 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