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


PHP License::find方法代码示例

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


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

示例1: destroy

 /**
  * Remove the specified resource from storage.
  * DELETE /branch/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $license = License::find($id);
     if ($license->status == 'used') {
         return Redirect::to('/licenses/' . $id)->with('alert', ['type' => 'danger', 'message' => 'No puedes borrar una licencia en uso.']);
     } else {
         License::destroy($id);
         return Redirect::to('/licenses')->with('alert', ['type' => 'success', 'message' => 'El libro ha sido borrado.']);
     }
 }
开发者ID:pombredanne,项目名称:licenser-7,代码行数:17,代码来源:LicenseController.php

示例2: postDeleteUsage

 public function postDeleteUsage($id)
 {
     // Get Usage
     $usage = LicensesUses::find($id);
     // Get License
     $license = License::find($usage->license_id);
     // Delete Usage
     $usage->delete();
     Session::flash('alert_message', '<strong>Done!</strong> You successfully have deleted a license usage.');
     return Redirect::to("admin/licenses/usage/{$license->license_key}");
 }
开发者ID:michaelotto126,项目名称:dksolution,代码行数:11,代码来源:LicensesController.php

示例3: getAcceptAsset

 public function getAcceptAsset($logID = null)
 {
     if (is_null($findlog = Actionlog::find($logID))) {
         // Redirect to the asset management page
         return Redirect::to('account')->with('error', Lang::get('admin/hardware/message.does_not_exist'));
     }
     // Asset
     if ($findlog->asset_id != '' && $findlog->asset_type == 'hardware') {
         $item = Asset::find($findlog->asset_id);
         // software
     } elseif ($findlog->asset_id != '' && $findlog->asset_type == 'software') {
         $item = License::find($findlog->asset_id);
         // accessories
     } elseif ($findlog->accessory_id != '') {
         $item = Accessory::find($findlog->accessory_id);
     }
     // Check if the asset exists
     if (is_null($item)) {
         // Redirect to the asset management page
         return Redirect::to('account')->with('error', Lang::get('admin/hardware/message.does_not_exist'));
     }
     return View::make('frontend/account/accept-asset', compact('item'))->with('findlog', $findlog);
 }
开发者ID:nicve,项目名称:snipe-it,代码行数:23,代码来源:ViewAssetsController.php

示例4: depreciate

 /**
  * Handle depreciation
  */
 public function depreciate()
 {
     $depreciation_id = License::find($this->license_id)->depreciation_id;
     if ($depreciation_id) {
         $depreciation_term = Depreciation::find($depreciation_id)->months;
         if ($depreciation_term > 0) {
             $purchase_date = strtotime($this->purchase_date);
             $todaymonthnumber = date("Y") * 12 + (date("m") - 1);
             //calculate the month number for today as YEAR*12 + (months-1) - number of months since January year 0
             $purchasemonthnumber = date("Y", $purchase_date) * 12 + (date("m", $purchase_date) - 1);
             //purchase date calculated similarly
             $diff_months = $todaymonthnumber - $purchasemonthnumber;
             // fraction of value left
             $current_value = round(($depreciation_term - $diff_months) / $depreciation_term * $this->purchase_cost, 2);
             if ($current_value < 0) {
                 $current_value = 0;
             }
             return $current_value;
         } else {
             return $this->purchase_cost;
         }
     } else {
         return $this->purchase_cost;
     }
 }
开发者ID:ramonkampinga,项目名称:snipe-it,代码行数:28,代码来源:License.php

示例5: getAcceptAsset

 public function getAcceptAsset($logID = null)
 {
     if (is_null($findlog = Actionlog::find($logID))) {
         // Redirect to the asset management page
         return Redirect::to('account')->with('error', Lang::get('admin/hardware/message.does_not_exist'));
     }
     $user = Sentry::getUser();
     if ($user->id != $findlog->checkedout_to) {
         return Redirect::to('account/view-assets')->with('error', Lang::get('admin/users/message.error.incorrect_user_accepted'));
     }
     // Asset
     if ($findlog->asset_id != '' && $findlog->asset_type == 'hardware') {
         $item = Asset::find($findlog->asset_id);
         // software
     } elseif ($findlog->asset_id != '' && $findlog->asset_type == 'software') {
         $item = License::find($findlog->asset_id);
         // accessories
     } elseif ($findlog->accessory_id != '') {
         $item = Accessory::find($findlog->accessory_id);
     }
     // Check if the asset exists
     if (is_null($item)) {
         // Redirect to the asset management page
         return Redirect::to('account')->with('error', Lang::get('admin/hardware/message.does_not_exist'));
     } else {
         if (!Company::isCurrentUserHasAccess($item)) {
             return Redirect::route('requestable-assets')->with('error', Lang::get('general.insufficient_permissions'));
         } else {
             return View::make('frontend/account/accept-asset', compact('item'))->with('findlog', $findlog);
         }
     }
 }
开发者ID:xtherebellion,项目名称:snipe-it,代码行数:32,代码来源:ViewAssetsController.php


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