-
app/Activity/Activity.php
Open in GitHubuse App\Base\Models\Notification; class Activity { public function getActivitiesForGroup($groupType, $groupId) { return Notification::where(['group_type' => $groupType, 'group_id' => $groupId])->orderBy('created_at', 'desc')->get()->groupBy('date'); } }
-
app/Base/Http/Controllers/ActivityController.php
Open in GitHubuse App\Activity\Activity; class ActivityController extends Controller { public function index() { $activity = new Activity(); $activities = $activity->getActivitiesForGroup(request('group_type'), request('group_id')); return response()->json([ 'status' => 'success', 'activities' => $activities, ]); } }