當前位置: 首頁>>代碼示例>>PHP>>正文


PHP validator::check方法代碼示例

本文整理匯總了PHP中validator::check方法的典型用法代碼示例。如果您正苦於以下問題:PHP validator::check方法的具體用法?PHP validator::check怎麽用?PHP validator::check使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在validator的用法示例。


在下文中一共展示了validator::check方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: slug

     $input['slug'] = slug($input['slug']);
     department::update($id, $input);
     Extend::process('department', $id);
     Notify::successs(__('departments.update'));
     return Response::redirect('admin/departments/edit/' . $id);
 });
 Route::get('admin/departments/add', function () {
     $vars['messages'] = Notify::read();
     $vars['token'] = Csrf::token();
     $vars['fields'] = Extend::fields('department');
     return View::create('departments/add', $vars)->partial('header', 'partials/header')->partial('footer', 'partials/footer');
 });
 Route::post('admin/departments/add', function () {
     $input = Input::get(array('title', 'slug', 'description'));
     $validator = new validator($input);
     $validator->check('title')->is_max(3, __('departments.title_missing'));
     if ($errors = $validator->errors()) {
         Input::flash();
         Notify::error($errors);
         return Response::redirect('admin/departments/add');
     }
     if (empty($input['slug'])) {
         $input['slug'] = $input['title'];
     }
     $input['slug'] = slug($input['slug']);
     $department = department::create($input);
     Extend::process('department', $department->id);
     Notify::success(__('departments.created'));
     return Response::redirect('admin/departments');
 });
 Route::get('admin/departments/delete/(:num)', function ($id) {
開發者ID:pepfi,項目名稱:anchor-cms,代碼行數:31,代碼來源:departments.php

示例2: slug

     $input['slug'] = slug($input['slug']);
     Company::update($id, $input);
     Extend::process('company', $id);
     Notify::successs(__('companies.update'));
     return Response::redirect('admin/companies/edit/' . $id);
 });
 Route::get('admin/companies/add', function () {
     $vars['messages'] = Notify::read();
     $vars['token'] = Csrf::token();
     $vars['fields'] = Extend::fields('company');
     return View::create('companies/add', $vars)->partial('header', 'partials/header')->partial('footer', 'partials/footer');
 });
 Route::post('admin/companies/add', function () {
     $input = Input::get(array('title', 'slug', 'description'));
     $validator = new validator($input);
     $validator->check('title')->is_max(3, __('companies.title_missing'));
     if ($errors = $validator->errors()) {
         Input::flash();
         Notify::error($errors);
         return Response::redirect('admin/companies/add');
     }
     if (empty($input['slug'])) {
         $input['slug'] = $input['title'];
     }
     $input['slug'] = slug($input['slug']);
     $company = Company::create($input);
     Extend::process('company', $company->id);
     Notify::success(__('companies.created'));
     return Response::redirect('admin/companies');
 });
 Route::get('admin/companies/delete/(:num)', function ($id) {
開發者ID:pepfi,項目名稱:anchor-cms,代碼行數:31,代碼來源:companies.php


注:本文中的validator::check方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。