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


PHP Build::modversions方法代码示例

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


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

示例1: action_do_addbuild

 public function action_do_addbuild($modpack_id)
 {
     if (empty($modpack_id)) {
         return Redirect::to('modpack');
     }
     $modpack = Modpack::find($modpack_id);
     if (empty($modpack)) {
         return Redirect::to('modpack');
     }
     $rules = array("version" => "required");
     $messages = array('version_required' => "You must enter in the build number.");
     $validation = Validator::make(Input::all(), $rules, $messages);
     if ($validation->fails()) {
         return Redirect::back()->with_errors($validation->errors);
     }
     $clone = Input::get('clone');
     $build = new Build();
     $build->modpack_id = $modpack->id;
     $build->version = Input::get('version');
     $minecraft = explode(':', Input::get('minecraft'));
     $build->minecraft = $minecraft[0];
     $build->minecraft_md5 = $minecraft[1];
     $build->save();
     if (!empty($clone)) {
         $clone_build = Build::find($clone);
         $version_ids = array();
         foreach ($clone_build->modversions as $cver) {
             if (!empty($cver)) {
                 array_push($version_ids, $cver->id);
             }
         }
         $build->modversions()->sync($version_ids);
     }
     return Redirect::to('modpack/build/' . $build->id);
 }
开发者ID:pustimeunutra,项目名称:TechnicSolder,代码行数:35,代码来源:modpack.php

示例2: postAddBuild

 public function postAddBuild($modpack_id)
 {
     $modpack = Modpack::find($modpack_id);
     if (empty($modpack)) {
         return Redirect::to('modpack/list')->withErrors(new MessageBag(array('Modpack not found')));
     }
     $rules = array("version" => "required", "memory" => "numeric");
     $messages = array('version.required' => "You must enter in the build number.", 'memory.numeric' => "You may enter in numbers only for the memory requirement");
     $validation = Validator::make(Input::all(), $rules, $messages);
     if ($validation->fails()) {
         return Redirect::back()->withErrors($validation->messages());
     }
     $clone = Input::get('clone');
     $build = new Build();
     $build->modpack_id = $modpack->id;
     $build->version = Input::get('version');
     $minecraft = Input::get('minecraft');
     $build->minecraft = $minecraft;
     $build->min_java = Input::get('java-version');
     $build->min_memory = Input::get('memory-enabled') ? Input::get('memory') : 0;
     $build->save();
     Cache::forget('modpack.' . $modpack->slug);
     if (!empty($clone)) {
         $clone_build = Build::find($clone);
         $version_ids = array();
         foreach ($clone_build->modversions as $cver) {
             if (!empty($cver)) {
                 array_push($version_ids, $cver->id);
             }
         }
         $build->modversions()->sync($version_ids);
     }
     return Redirect::to('modpack/build/' . $build->id);
 }
开发者ID:GoatEli,项目名称:TechnicSolder,代码行数:34,代码来源:ModpackController.php


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