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


PHP Home::create方法代碼示例

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


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

示例1: store

 /**
  * Store a newly created home in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make($data = Input::all(), Home::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     Home::create($data);
     return Redirect::route('homes.index');
 }
開發者ID:vnzacky,項目名稱:exp_services,代碼行數:14,代碼來源:HomesController.php

示例2: Validate

use Environment\Core\Validate;
use Environment\Helpers\Html;
use Environment\Helpers\Link;
use Environment\Helpers\Form;
use Environment\Helpers\Date;
use Environment\Helpers\String;
App::setTitle('Add user');
Input::find('user.login');
if (Input::isSubmit()) {
    // echo Input::find('username');
    $check = new Validate();
    $validates_result = $check->validates($_POST['user'], ['login' => ['presence' => true, 'length' => ['minimum' => 3, 'maximum' => 50], 'uniqueness' => 'users'], 'password' => ['presence' => true, 'length' => ['minimum' => 3], 'confirmation' => true]]);
    if ($validates_result->isValid()) {
        $user = new Home();
        try {
            $user->create(['login' => Input::find('login'), 'email' => Input::find('email'), 'password' => Input::find('password'), 'group_id' => 1]);
            Redirect::to(['controller' => 'home', 'action' => 'index', 'params' => []]);
        } catch (Exception $e) {
            die($e->getMessage);
        }
    } else {
        echo '<div class="errors">';
        foreach ($validates_result->errors() as $error) {
            echo $error . '</br>';
        }
        echo '</div>';
    }
}
?>

<form action="" method="post">
開發者ID:ale88andr,項目名稱:RHP,代碼行數:31,代碼來源:add.html.php

示例3: function

//     return 'Middleware should be first palce';
// });
$route->respond('GET', '/', function () use($home) {
    return $home->index();
});
$route->respond('GET', '/test', function () use($user, $role) {
    $users = $user->all();
    foreach ($users as $user) {
        var_dump($user->role->permission);
    }
});
$route->respond('GET', '/show/[i:id]', function ($request) use($home) {
    return $home->show($request);
});
$route->respond('GET', '/create', function () use($home) {
    return $home->create();
});
$route->respond('POST', '/store', function ($request, $response) use($home) {
    return $home->store($request, $response);
});
$route->respond('GET', '/login', function () use($home) {
    echo $home->getLogin();
    unset($_SESSION['flash']);
});
$route->respond('POST', '/login', function ($request, $response, $service) use($home) {
    return $home->postLogin($request, $response, $service);
});
$route->respond('GET', '/logout', function ($request, $response, $service) use($home) {
    return $home->logout($request, $response, $service);
});
$route->respond('GET', '/dashboard/index', function ($request, $response) use($dashboard) {
開發者ID:nahidex,項目名稱:Employee-Leave-Management-,代碼行數:31,代碼來源:routes.php


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