Answers for "laravel response message"

PHP
1

laravel make:request messages

public function rules()
{
    return [
        'title' => 'required|unique:posts|max:255',
        'body' => 'required',
    ];
}

public function messages()
{
    return [
        'title.required' => 'A title is required',
        'body.required' => 'A message is required',
    ];
}
Posted by: Guest on July-27-2021
1

laravel controller return message

#In Controller
use Session;
       
Session::flash('message', "Special message goes here");
return Redirect::back();

#In View
@if (Session::has('message'))
   <div class="alert alert-info">{{ Session::get('message') }}</div>
@endif
Posted by: Guest on June-28-2021

Code answers related to "laravel response message"

Browse Popular Code Answers by Language