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

with message in laravel

@if (Session::has('success'))
    <div class="alert alert-success">
        <ul>
            <li>{!! Session::get('success') !!}</li>
        </ul>
    </div>
@endif
Comment

with message in laravel

 return redirect()->back()->with('success', 'your message,here');   
Comment

return with success message laravel

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

 return redirect()->back()->with('error', __('Permission Denied.'));
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 :: laravel filesystem link 
Php :: json_encode php 
Php :: php rearrange array 
Php :: php split array into chunks 
Php :: FPDF invoice Tutorial 
Php :: php pdo 
Php :: php if input is empty 
Php :: insert into database with seeder 
Php :: how to create constant in php 
Php :: php object is empty 
Php :: laravel permission 
Php :: php json_encode float 
Php :: close connection pdo 
Php :: laravel project make 
Php :: contact form 7 in page template 
Php :: laravel reading log file 
Php :: how to declare global variable in laravel controller 
Php :: arc cosine php 
Php :: php dirname 
Php :: in array php 
Php :: check if input file is empty in php 
Php :: encryption and decryption in php example 
Php :: how to get length array in php 
Php :: how to add two string in php 
Php :: laravel CORS config `allowed_origins` should be an array 
Php :: php buffer 
Php :: how to start the index from 1 in php? 
Php :: socket in laravel 
Php :: A Livewire component was not found 
Php :: best custom email validation rule for laravel 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =