$router->get('mails/send', 'MailController@send');
$router->post('mails/send', 'MailController@send');
public function send(Content $content)
{
//添加請(qǐng)求
if (request()->isMethod('post')) {
//驗(yàn)證
$data = request()->post();
$validate = Validator::make($data, [
'title' => 'required|max:125',
'content' => 'required'
]);
//處理
if ($validate->fails()) {
$content->withWarning('提醒', $validate);
} else {
Mail::create($data);
$content->withSuccess('提醒', '操作成功');
return redirect('/admin/mails');
}
}
$content->header('群發(fā)郵件');
$form = new \Encore\Admin\Widgets\Form();
$form->action('send');
$form->text('title','標(biāo)題')->rules('required');
$form->textarea('content','內(nèi)容')->rules('required');
$content->body($form);
$js = SCRIPT
SCRIPT;
Admin::script($js);
return $content;
}
以上這篇基于Laravel-admin 后臺(tái)的自定義頁(yè)面用法詳解就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。