本文整理汇总了PHP中DashboardController::cacheList方法的典型用法代码示例。如果您正苦于以下问题:PHP DashboardController::cacheList方法的具体用法?PHP DashboardController::cacheList怎么用?PHP DashboardController::cacheList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DashboardController
的用法示例。
在下文中一共展示了DashboardController::cacheList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveToList
function saveToList($id, $contact, $linkedin_contact_id)
{
$item_id = null;
if (Auth::check()) {
$user = User::find(Auth::user()->id);
if ($user->credits > 0) {
$user->credits = $user->credits - 1;
$user->save();
} else {
$subscription = Auth::user()->subscription()->first();
$transactions = Auth::user()->subscription()->first()->transaction()->get();
$plan_id = $subscription->plan_id;
$plan = Plan::find($plan_id);
foreach ($transactions as $transaction) {
if ($transaction->transaction_type == "charge" && $transaction->paid == 1 && $transaction->refunded == 0) {
if ($transaction->credits > 0) {
$transaction->credits = $transaction->credits - 1;
$transaction->save();
break;
}
}
}
}
$list = Lists::where('user_id', '=', $id)->first();
if (is_numeric($list->id)) {
DB::table('list_item')->insert(array('lists_id' => $list->id, 'linkedin_contact_id' => $linkedin_contact_id, 'linkedin' => $contact));
$lists = DB::table('list_item')->where('lists_id', '=', $list->id)->get();
$item_id = $lists[count($lists) - 1]->id;
DashboardController::cacheList($id, 0);
}
}
return $item_id;
}