I am creating an addon to an existing website using Laravel 5.1. The existing website uses Smarty as opposed to Blade templating system.
I have Laravel installed and working perfectly well. However, when I create a Request validator it doesn't send the $_SESSION['message'] value back to the page.
For example if I fill out a form but leave a required field blank, Laravel sends the user back to the page an displays some errors to tell the user to fill in the blank required field. However, I can't manage to get the error displaying on the page.
Here is my controller:
/**
* Add new project.
*
* @param AddNewProjectRequest $request
* @return Redirect
*/
public function add(AddNewProjectRequest $request)
{
// Create new project
$project = $this->project->add($request->only('name', 'number', 'builder', 'overall_budget', 'start_date', 'end_date'));
// Event(s);
Event::fire(new ProjectAdded($project, $request->only('file')));
// Redirect user
return redirect('../superusers/projectAdded');
}
And here is the part of my Smarty template that needs to display the error:
{if $smarty.session.message}
<div class="alert alert-success">
<ul>
<li>{$smarty.session.message}</li>
</ul>
</div>
{/if}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire