Search
 
SCRIPT & CODE EXAMPLE
 

PHP

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
Comment

return with success message laravel

 return redirect()->route('agent')->with(
            'success', __('Agent successfully added!')
        );

 return redirect()->back()->with('error', __('Permission Denied.'));
Comment

message get with return action laravel

return back()->with('message', 'WORKS!');

@if(session()->has('message'))
    <div class="alert alert-success">
        {{ session()->get('message') }}
    </div>
@endif
Comment

return message in laravel


create validation errors 
<!-- /resources/views/post/create.blade.php -->

<h1>Create Post</h1>

@if ($errors->any())
    <div class="alert alert-danger">
        <ul>
            @foreach ($errors->all() as $error)
                <li>{{ $error }}</li>
            @endforeach
        </ul>
    </div>
@endif

<!-- Create Post Form -->








##error message:
<!-- /resources/views/post/create.blade.php -->

<label for="title">Post Title</label>

<input id="title" type="text" name="title" class="@error('title') is-invalid @enderror">

@error('title')
    <div class="alert alert-danger">{{ $message }}</div>
@enderror
Comment

PREVIOUS NEXT
Code Example
Php :: substr() php 
Php :: full name validation laravel 
Php :: laravel check if get is empty 
Php :: php sort multidimensional array 
Php :: php temp directory 
Php :: No data was received to import. Either no file name was submitted, or the file size exceeded the maximum size permitted by your PHP configuration 
Php :: laravel db transaction 
Php :: how add confirmation box in php before deleting 
Php :: how to echo line number in php 
Php :: str_includes php 
Php :: php milliseconds 
Php :: php subtract mins to datetime 
Php :: alert in php 
Php :: disable register laravel 
Php :: echo alert php 
Php :: php sleep half a second 
Php :: how tdo you convert a stringto lowercase in php 
Php :: check is domain php 
Php :: redirect php 
Php :: debug query in moodle 
Php :: laravel 8 plural singular 
Php :: laravel random column with limit 
Php :: wordpress post excerpt from post id 
Php :: php JSON_PRETTY_PRINT and ? 
Php :: post thumbnail 
Php :: laravel create model with migration and resource controller 
Php :: how to set session timeout in codeigniter 
Php :: how to check if input is number only in php 
Php :: PHP Fatal error: Constructor test::test() cannot declare a return type in /home/iBMCb9/prog.php on line 6 
Php :: how change default value for enum colun in laravel 
ADD CONTENT
Topic
Content
Source link
Name
8+7 =