当前位置: 首页>>代码示例>>PHP>>正文


PHP Shop::create方法代码示例

本文整理汇总了PHP中Shop::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Shop::create方法的具体用法?PHP Shop::create怎么用?PHP Shop::create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Shop的用法示例。


在下文中一共展示了Shop::create方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: store

 /**
  * Store a newly created shop in storage.
  *
  * @return Response
  */
 public function store()
 {
     $shopValidator = Validator::make($data = Input::all(), Shop::$rules);
     if ($shopValidator->fails()) {
         return Redirect::back()->withErrors($shopValidator)->withInput();
     }
     /* Shop */
     if (Input::has('createShop')) {
         Shop::create($data);
     }
     $message = "登録しました。";
     if (Input::has('deleteShop')) {
         $s = Shop::where('Tenpo', Input::get('Tenpo'))->first();
         Shop::destroy($s->id);
         $message = "削除しました。";
         if (Input::has('selectedShop')) {
             Input::replace(array('selectedShop', ''));
         }
     }
     if (Input::has('updateShop')) {
         $messages = array('required' => '新しい店舗名を入力してください。');
         $shopValidator = Validator::make($data = Input::all(), Shop::$update_rules, $messages);
         if ($shopValidator->fails()) {
             return Redirect::back()->withErrors($shopValidator)->withInput();
         }
         $s = Shop::where('Tenpo', Input::get('Tenpo'))->first();
         Shop::destroy($s->id);
         $data['Tenpo'] = $data['new_shopName'];
         Shop::create($data);
         $message = "更新しました。";
     }
     return Redirect::route('employees.index')->with('message', $message);
 }
开发者ID:noikiy,项目名称:posco-laravel-server,代码行数:38,代码来源:ShopsController.php

示例2: Shop

if(isset($_POST['submit'])) {
    $shop = new Shop();
    
    foreach($_POST AS $key => $value) {
        if(in_array($key, $allowed)) {
            $$key = $value;
     
            if(in_array($key, $required) && $value == '') {
                $errors[] = "The field <strong>{$key}</strong> is required.";
            }
        }
    }

    if(count($errors) < 1) { 
        if($shop->create($world, $name, $owner, $managers, $creator, $position1, $position2, $money, $stock)) {
            $success = "Created shop {$name}, <a href='editor.php?edit={$name}'>edit</a> or <a href='add-item.php?name={$name}'>add items</a>?";
        } else {
            $errors[] = "Could not create shop {$name}!";
        }
    }
}

if(count($errors) > 0):
    echo '<p><strong>There was an error processing the form.</strong></p>';
    echo '<ul>';
    
    foreach($errors as $error):
        echo "<li>$error</li>";
    endforeach;
    
开发者ID:nijikokun,项目名称:ls_editsuite,代码行数:29,代码来源:generate.php

示例3: new_shop

 public function new_shop()
 {
     $rules = array('shop_name' => 'required');
     $validator = Validator::make(Input::all(), $rules);
     if (!$validator->fails()) {
         $user = Shop::create(Input::only('shop_name'));
         $user->save();
         return Redirect::to('admin/shops')->with('success', 'Shop created successfully!');
     } else {
         return Redirect::back()->withErrors($validator);
     }
 }
开发者ID:ecuation,项目名称:Voucher-project,代码行数:12,代码来源:AdminController.php


注:本文中的Shop::create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。