Laravel controller thinks my function is undefined
laravel, php
Solution
It looks like you're trying to call `$this->validate()`, instead of `validate()`. You've defined `validate()` as a class method, not a stand alone function.
Problem
Pretty simple. I'm trying to call a function from within my controller. The function is, in fact, defined. Yet, when the function is called I get "PHP Fatal Error: Call to undefined function validate() ..." Here's my code. Any ideas? Thanks. ``` <?php class HomeController extends BaseController { /** * Controller for the index action of the home page. Displays the landing page. */ public function index() { return View::make('landing', array('success' => false)); } /** * Controller to handle processing the contact form and re-displaying the landing page */ public function processForm() { $form_array = array(); $errors = array(); foreach (array('email','fname','lname','message','newsletter') as $val) { if (isset($_POST[$val])) $form_array[$val] = $_POST[$val]; else $form_array[$val] = null; } $form_ok = validate(); if ($form_ok) { echo "GOOD!"; } else { echo "BAD!"; } } /** * Helper function for validating the form. Returns true if the form was * submitted without errors. */ public function validate() { return true; } } ```