我目前在提交以下方法的laravel中有一个表单:
public function validateSave() {
$qualitycheck = new QualityCheck();
$qualitycheck['site-name'] = Request::input('site-name');
$qualitycheck['favicon'] = Request::has('favicon');
$qualitycheck['title'] = Request::has('title');
$qualitycheck['image-optimization'] = Request::has('image-optimization');
$qualitycheck->save();
Session::flash('quality-data', $qualitycheck);
return redirect('/');
}
所以我有以下行将数据传递到下一页:
Session::flash('quality-data', $qualitycheck);
但我真正想做的是,当提交表单时,我真的只想在下一页上显示一个链接,其编码如下:
@if(Session::has('quality-data'))
<a href="">Submited Quality Check</a>
@endif
现在点击链接,我想显示一个视图,其中包含用户在表单中提交的所有数据,我该怎么做? I.E.如何将数据表单从<a>
传递到点击<a>
时显示的视图?
所以只是为了把事情放在眼里,这就是它现在的运作方式:
STEP-1 :: User submits form , data is flashed to next page.
STEP-2 :: Data user submits is shown on this page.
我希望它如何工作:
STEP-1 :: User submits form , data is flashed to next page.
STEP-2 :: A link is shown to the user(Only if user clicks on the link we move to the next step).
STEP-3 :: Data user submited in first step is shown on this page.
答案 0 :(得分:1)
下次编码时,请遵循以下编码惯例。
create()
功能。$input
)route('route.name')
之类的路由名称,而不是redirection()
函数内的字符串。请用
替换您的功能public function validateSave() {
$inputs = [
'site-name' => request()->get('site_name'),
'favicon' => request()->has('facvicon'),
'title' => request()->has('title'),
'image-optimization' => request()->has('image-optimization')
]);
$qualityCheck = QualityCheck::create($inputs);
$flashMessage = '<a href=' . route('quality.check.show', $qualityCheck) . '>Submitted Quality Check</a>'
Session::flash('quality-data', $flashMessage);
return redirect(route('home.index'));
}
确保路线文件中有类似的内容。
Route::get('quality-check/{id}', 'QualityCheckController')->name('quality.check.show');
如果有什么不起作用,请告诉我......
答案 1 :(得分:0)
guard let window = UIApplication.shared.keyWindow else {
return
}
guard let rootViewController = window.rootViewController else {
return
}
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyboard.instantiateViewController(withIdentifier: "MainTabbar")
vc.view.frame = rootViewController.view.frame
vc.view.layoutIfNeeded()
UIView.transition(with: window, duration: 0.3, options: .transitionCrossDissolve, animations: {
window.rootViewController = vc
}, completion: { completed in
// maybe do something here
})