<?php
function flash($message) {
session()->flash('message', $message);
}
Route::post('projects', function() {
// validate the projects
// save the projects
// flash('Your project has been created.'); // * Using the flash method above
// OR
session()->flash('message', 'Your project has been created.');
return redirect('/');
// return redirect('/')->with('message', 'Your project has been created.'); // * Shortcut option
});
// * Shortcut option
Route::post('projects', function() {
// validate the projects
// save the projects
return redirect('/')->with('message', 'Your project has been created.'); // * Shortcut option
});