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


PHP Resource::save方法代码示例

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


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

示例1: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = Resource::validate(Input::all());
     if ($validator->fails()) {
         return Redirect::to('resources/create')->withErrors($validator)->withInput(Input::all());
     } else {
         // store
         $resource = new Resource();
         $resource->name = Input::get('name');
         $resource->description = Input::get('description');
         $resource->url = Input::get('url');
         $resource->hits = 0;
         $resource->level = Input::get('level');
         $resource->faculty = Input::get('faculty');
         $deviceIds = Input::get('devices');
         $tagIds = Input::get('tag_ids');
         $resource->save();
         if ($tagIds != '') {
             $tagIds = explode(",", $tagIds);
             $resource->tags()->attach($tagIds);
         }
         if ($deviceIds != '') {
             foreach ($deviceIds as $device_type) {
                 $device = new Device(array("device_type" => $device_type));
                 $resource->devices()->save($device);
             }
         }
         return Redirect::to('resources');
     }
 }
开发者ID:shankargiri,项目名称:Quantum-Vic-La-Trobe-L4,代码行数:35,代码来源:ResourcesController.php

示例2: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Resource();
     $model->attributes = $_POST;
     $result = $model->save();
     $this->sendAjaxResponse($model);
 }
开发者ID:pdooley,项目名称:genesis,代码行数:11,代码来源:ResourceController.php

示例3: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Resource();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Resource'])) {
         $model->attributes = $_POST['Resource'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:rafaelang,项目名称:rpg,代码行数:17,代码来源:ResourceController.php

示例4: postResource

function postResource($resourceId = 0)
{
    global $app;
    // INSERT Resource
    $resource = new Resource();
    $resource->param1 = 'hello';
    $resource->param2 = 'world';
    $resource->save();
    if ($resource) {
        $app->response->setStatus(200);
        echo $resource->toJson();
    } else {
        $app->response->setStatus(400);
        echo '{"error":{"text":"request failed"}}';
    }
}
开发者ID:tylerbuchea,项目名称:slim-eloquent-api-starter,代码行数:16,代码来源:index.php

示例5: Resource

<?php

$resourceID = $_POST['resourceID'];
$resource = new Resource(new NamedArguments(array('primaryKey' => $resourceID)));
try {
    $resource->save();
    //first remove all payment records, then we'll add them back
    $resource->removeResourcePayments();
    $yearArray = array();
    $yearArray = explode(':::', $_POST['years']);
    $subStartArray = array();
    $subStartArray = explode(':::', $_POST['subStarts']);
    $subEndArray = array();
    $subEndArray = explode(':::', $_POST['subEnds']);
    $fundIDArray = array();
    $fundIDArray = explode(':::', $_POST['fundIDs']);
    $paymentAmountArray = array();
    $paymentAmountArray = explode(':::', $_POST['paymentAmounts']);
    $currencyCodeArray = array();
    $currencyCodeArray = explode(':::', $_POST['currencyCodes']);
    $orderTypeArray = array();
    $orderTypeArray = explode(':::', $_POST['orderTypes']);
    $costDetailsArray = array();
    $costDetailsArray = explode(':::', $_POST['costDetails']);
    $costNoteArray = array();
    $costNoteArray = explode(':::', $_POST['costNotes']);
    $invoiceArray = array();
    $invoiceArray = explode(':::', $_POST['invoices']);
    foreach ($orderTypeArray as $key => $value) {
        if ($value && ($paymentAmountArray[$key] || $yearArray[$key] || $fundIDArray[$key] || $costNoteArray[$key])) {
            $resourcePayment = new ResourcePayment();
开发者ID:pontifechs,项目名称:resources,代码行数:31,代码来源:submitCost.php

示例6: save

 public function save(Resource $resource)
 {
     return $resource->save();
 }
开发者ID:avaza,项目名称:arc,代码行数:4,代码来源:ResourceRepository.php

示例7: count

     $resources = $resourceObj->getResourceByIsbnOrISSN($deduping_values);
     $resource = $resources[0];
 }
 // Do we have a parent resource to create?
 if ($data[$_POST['parentResource']] && ($deduping_count == 0 || $deduping_count == 1)) {
     // Search if such parent exists
     $numberOfParents = count($resourceObj->getResourceByTitle($data[$_POST['parentResource']]));
     $parentID = null;
     if ($numberOfParents == 0) {
         // If not, create parent
         $parentResource = new Resource();
         $parentResource->createLoginID = $loginID;
         $parentResource->createDate = date('Y-m-d');
         $parentResource->titleText = $data[$_POST['parentResource']];
         $parentResource->statusID = 1;
         $parentResource->save();
         $parentID = $parentResource->resourceID;
         $parentInserted++;
     } elseif ($numberOfParents == 1) {
         // Else, attach the resource to its parent.
         $parentResource = $resourceObj->getResourceByTitle($data[$_POST['parentResource']]);
         $parentID = $parentResource[0]->resourceID;
         $parentAttached++;
     }
     if ($numberOfParents == 0 || $numberOfParents == 1) {
         $resourceRelationship = new ResourceRelationship();
         $resourceRelationship->resourceID = $resource->resourceID;
         $resourceRelationship->relatedResourceID = $parentID;
         $resourceRelationship->relationshipTypeID = '1';
         //hardcoded because we're only allowing parent relationships
         if (!$resourceRelationship->exists()) {
开发者ID:jsteverman,项目名称:resources,代码行数:31,代码来源:import.php


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