feat: add bylaw management features including documents, legal authorities, subject categories, and nodes
This commit is contained in:
@@ -29,7 +29,7 @@ class HomeController extends Controller
|
||||
return [
|
||||
'id' => $q->law?->id,
|
||||
'name' => $q->law?->title,
|
||||
'is_locked' => $q->law?->is_locked
|
||||
'is_locked' => $q->law?->is_locked,
|
||||
];
|
||||
});
|
||||
|
||||
@@ -37,7 +37,7 @@ class HomeController extends Controller
|
||||
return [
|
||||
'id' => $q->id,
|
||||
'name' => $q->title,
|
||||
'is_locked' => $q->is_locked
|
||||
'is_locked' => $q->is_locked,
|
||||
];
|
||||
});
|
||||
|
||||
@@ -49,13 +49,13 @@ class HomeController extends Controller
|
||||
$q->where('type', $category);
|
||||
})->get()->map(function ($q) {
|
||||
return [
|
||||
"id" => $q->id,
|
||||
"title" => $q->title,
|
||||
"is_locked" => $q->is_locked,
|
||||
"category_id" => $q->category_id,
|
||||
"price" => $q->price,
|
||||
"image" => $q->image,
|
||||
"type" => 'law'
|
||||
'id' => $q->id,
|
||||
'title' => $q->title,
|
||||
'is_locked' => $q->is_locked,
|
||||
'category_id' => $q->category_id,
|
||||
'price' => $q->price,
|
||||
'image' => $q->image,
|
||||
'type' => 'law',
|
||||
];
|
||||
});
|
||||
}
|
||||
@@ -64,7 +64,7 @@ class HomeController extends Controller
|
||||
return [
|
||||
'id' => $q->id,
|
||||
'name' => $q->title,
|
||||
'is_locked' => $q->is_locked
|
||||
'is_locked' => $q->is_locked,
|
||||
];
|
||||
});
|
||||
|
||||
@@ -83,7 +83,7 @@ class HomeController extends Controller
|
||||
'name' => $freeSubscription->subscribe->name,
|
||||
'price' => $freeSubscription->subscribe->price,
|
||||
'expired_day' => $freeSubscription->expired_at->diffInDays(now()),
|
||||
'is_free' => true
|
||||
'is_free' => true,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -92,7 +92,9 @@ class HomeController extends Controller
|
||||
->latest('expired_at')
|
||||
->first();
|
||||
|
||||
$expiredDays = UserSubscriber::query()->where('user_id', $user->id)->where('expired_at', '>=', now())->get()->sum(function ($subscriber) {return $subscriber->expired_at->diffInDays(now());});
|
||||
$expiredDays = UserSubscriber::query()->where('user_id', $user->id)->where('expired_at', '>=', now())->get()->sum(function ($subscriber) {
|
||||
return $subscriber->expired_at->diffInDays(now());
|
||||
});
|
||||
|
||||
if ($latestSubscription) {
|
||||
$current_plan = [
|
||||
@@ -100,7 +102,7 @@ class HomeController extends Controller
|
||||
'name' => $latestSubscription->subscribe->name ?? 'Subscription',
|
||||
'price' => $latestSubscription->subscribe->price ?? 100,
|
||||
'expired_day' => $expiredDays,
|
||||
'is_free' => (bool) $latestSubscription->is_free
|
||||
'is_free' => (bool) $latestSubscription->is_free,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -119,9 +121,9 @@ class HomeController extends Controller
|
||||
private function refreshMarketSubscriptionAfterResponse($user): void
|
||||
{
|
||||
$cacheKey = "home-market-refresh-user-{$user->id}";
|
||||
$this->refreshMarketSubscription($user);
|
||||
$this->refreshMarketSubscription($user);
|
||||
|
||||
if (!Cache::add($cacheKey, true, now()->addHours(24))) {
|
||||
if (! Cache::add($cacheKey, true, now()->addHours(24))) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -164,6 +166,6 @@ class HomeController extends Controller
|
||||
return true;
|
||||
}
|
||||
|
||||
return !$subscriber->last_verified_at || $subscriber->last_verified_at->lessThan(now()->subHours(12));
|
||||
return ! $subscriber->last_verified_at || $subscriber->last_verified_at->lessThan(now()->subHours(12));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user