php - Undefined Variable in function -


Hello everyone I am creating a simple database search and inside the function it says that a variable is not defined by me It looks like this is a simple fix, but I can not seem to know why I can not give an array to see it, anybody wants help that my controller is down.

Threw message with error "Undefined Variable: Array" error error 18: \ xampp \ htdocs \ Laravel \ app \ controller \ HomeController.php: 24

  & lt ;? Expands Php Class Home Controller BaseController {Public Function Show Welcome () {Return View :: Create ('Hello'); } Public function getSearch () {$ query = input :: get ('query'); $ Validator = verifier :: make (input :: all (), array ('query' = & gt; 'required | minimum: 5 | maximum: 50')); If ($ verifier- & gt; fails ()) {echo "badged"; } ('Name', 'like', '% $ query%') and {$ raw_results = DB :: table ('student') - & gt; Select ('name', 'date', 'class') - & gt; ") - & gt; Mill (); $ Array = json_decode (json_encode ($ raw_results), true);} See return :: create ('Student.Student', array ('result' => $ array)) ;}   

}

thanks Chris I put $ array Needed as an empty array in the validator

   class home extension extends the BaseController {Welcome to Public Function Show} {Return View :: Create (Hello ');} Public function getSearch () {$ query = input :: get (' query '); $ validator = verifier :: m (Input :: All (), array ('query' = & gt; 'required | minimum: 5 | maximum: 50')); if ($ verifier- & gt; fails ()) {echo "badged "; $ Array = array ();} ('name', 'like', '% $ query%') and {$ raw_results = DB :: table ('student') -> select ('name' , 'Date', 'Class') - & gt; ") - & gt; Find (); $ Array = json_decode (json_encode ($ raw_results, true); } View return: create ('hello', array ('result' => $ array); }}    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -