当前位置: 首页>>代码示例>>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;未经允许,请勿转载。