本文整理汇总了PHP中app\models\Company::isCurrentUserAuthorized方法的典型用法代码示例。如果您正苦于以下问题:PHP Company::isCurrentUserAuthorized方法的具体用法?PHP Company::isCurrentUserAuthorized怎么用?PHP Company::isCurrentUserAuthorized使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Company
的用法示例。
在下文中一共展示了Company::isCurrentUserAuthorized方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postBulkDelete
/**
* Save bulk deleted.
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @param array $assets
* @since [v2.0]
* @return View
*/
public function postBulkDelete($assets = null)
{
if (!Company::isCurrentUserAuthorized()) {
return redirect()->to('hardware')->with('error', trans('general.insufficient_permissions'));
} elseif (Input::has('bulk_edit')) {
//$assets = Input::get('bulk_edit');
$assets = Asset::find(Input::get('bulk_edit'));
//print_r($assets);
foreach ($assets as $asset) {
//echo '<li>'.$asset;
$update_array['deleted_at'] = date('Y-m-d h:i:s');
$update_array['assigned_to'] = null;
if (DB::table('assets')->where('id', $asset->id)->update($update_array)) {
$logaction = new Actionlog();
$logaction->asset_id = $asset->id;
$logaction->asset_type = 'hardware';
$logaction->created_at = date("Y-m-d H:i:s");
$logaction->user_id = Auth::user()->id;
$log = $logaction->logaction('deleted');
}
}
// endforeach
return redirect()->to("hardware")->with('success', trans('admin/hardware/message.delete.success'));
// no values given, nothing to update
} else {
return redirect()->to("hardware")->with('info', trans('admin/hardware/message.delete.nothing_updated'));
}
// Something weird happened here - default to hardware
return redirect()->to("hardware");
}