the browser-facing portion of osu!
at master 1.2 kB view raw
1<?php 2 3// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0. 4// See the LICENCE file in the repository root for full licence text. 5 6namespace App\Http\Controllers\Forum; 7 8use App\Http\Controllers\Controller as BaseController; 9use App\Models\Forum\Forum; 10use App\Models\Forum\Post; 11use App\Models\Forum\Topic; 12use App\Models\Log; 13 14abstract class Controller extends BaseController 15{ 16 public function logModerate($operation, $data, $object) 17 { 18 if ($object instanceof Forum) { 19 $forumId = $object->getKey(); 20 } elseif ($object instanceof Topic) { 21 $forumId = $object->forum_id; 22 $topicId = $object->getKey(); 23 } elseif ($object instanceof Post) { 24 $forumId = $object->forum_id; 25 $postId = $object->getKey(); 26 $topicId = $object->topic_id; 27 } 28 29 $this->log([ 30 'log_type' => Log::LOG_FORUM_MOD, 31 'log_operation' => $operation, 32 'log_data' => $data, 33 34 'forum_id' => $forumId ?? null, 35 'post_id' => $postId ?? null, 36 'topic_id' => $topicId ?? null, 37 ]); 38 } 39}