laravel如何返回提示成功?
如果保存失败是这样代码
return redirect()->back()->withInput()->withErrors('保存失败!');如果保存成功,在有模版情况下如何返回呢?
return redirect('/模版)->??????('保存成功');或者在模版出现提示成功
return redirect('/模版)->with('保存成功',$ok); //总不能一直显示。。==============================================================================
路由器:
   
    Route::get('/config', 'ConfigsController@index');
    Route::post('config/add', [
        'as' => 'add',
        'uses' => 'ConfigsController@add'
    ]);控制器
<?php namespace App\Http\Controllers\Admin;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Configs;
use Input;
use Illuminate\Http\Response;
class ConfigsController extends Controller {
    /**
     * 显示配置页面,从数据库ID=1获取
     */
    public function index()
    {
        $config_view = Configs::find(1);
        return view('admin.write_config')->with('config_db',$config_view);
    }
    /**
     * 提交更新数据,表单验证
     */
    public function add(Request $request)
    {
        $this->validate($request, [
                'web_name' => 'required',
                'web_add' =>'required',
                'web_email' => 'required|email',
                'web_copy' => 'required',
                'web_keywords' => 'required',
                'web_description' => 'required',
            ]
        );
        $configs = Configs::find(1);
        $configs->web_name = Input::get('web_name');
        $configs->web_add = Input::get('web_add');
        $configs->web_email = Input::get('web_email');
        $configs->web_copy = Input::get('web_copy');
        $configs->web_keywords = Input::get('web_keywords');
        $configs->web_description = Input::get('web_description');
        //判断,如果通过验证,那么第一步跳转到config页面,并且显示成功
        if ($configs->save()) {
            return redirect('/admin/config')->with('status', 'Update Success! 成功! :)');
        } else {
            return redirect()->back()->withInput()->withErrors('保存失败!');
        }
    }
}
模版页面
@extends('admin.admin')
@section('content')
    <div class="home_con">
        <h3>基本设置</h3>
        <form method="post" action="/admin/config/add" class="forms">
      
           //对中文显示无效
 
            @if (session('status'))
                 
                <div class="tools-alert tools-alert-green">
                    {{ session('status') }}
                </div>
            @endif
    
            @if (count($errors) > 0)
                <div class="tools-alert tools-alert-red">
                    <strong>错误</strong>你填写数据有问题!请重新填写!<br><br>
                    <ul>
                        @foreach ($errors->all() as $error)
                            <li>{{ $error }}</li>
                        @endforeach
                    </ul>
                </div>
            @endif
            <label>
                网站名称
                <input type="text" name="web_name" class="width-50" value="{{$config_db->web_name}}" />
            </label>
            <label>
                网站地址
                <input type="text" name="web_add" class="width-50"  value="{{$config_db->web_add}}" />
            </label>
            <label>
                管理邮箱
                <input type="text" name="web_email" class="width-50"  value="{{$config_db->web_email}}" />
            </label>
            <label>
                版权信息
                <input type="text" name="web_copy" class="width-50"  value="{{$config_db->web_copy}}" />
            </label>
            <br>
            <h3>SEO管理</h3>
            <label>
                网站关键词
                <input type="text" name="web_keywords" class="width-50"  value="{{$config_db->web_keywords}}" />
            </label>
            <label>
                网站描述
                <input type="text" name="web_description" class="width-50"  value="{{$config_db->web_description}}" />
            </label>
            <input type="submit" class="btn btn-blue" value="更新" />
            <input type="hidden" name="_token" value="{{ csrf_token() }}">
        </form>
    </div>
@endsection