Ziemlich einfach. Ich versuche eine Funktion von meinem Controller aus aufzurufen. Die Funktion ist tatsächlich definiert. Doch wenn die Funktion aufgerufen wird, bekomme ich "PHP Fatal Error: Aufruf zu undefinierter Funktion validate() ..."Laravel-Controller denkt, dass meine Funktion nicht definiert ist
Hier ist mein Code. Irgendwelche Ideen? Vielen Dank.
<?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;
}
}
Ugh ... dumme mich. Vielen Dank! – Vince