����JFIF��x�x����'
Server IP : 78.140.185.180 / Your IP : 18.222.34.209 Web Server : LiteSpeed System : Linux cpanel13.v.fozzy.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : builderbox ( 1072) PHP Version : 7.3.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/builderbox/www/common/Comments/ |
Upload File : |
<?php namespace Common\Comments; use Common\Auth\BaseUser; use Common\Core\Policies\BasePolicy; class CommentPolicy extends BasePolicy { public function index(BaseUser $user, $userId = null) { return $user->hasPermission('comments.view') || $user->id === (int) $userId; } public function show(BaseUser $user, Comment $comment) { return $user->hasPermission('comments.view') || $comment->user_id === $user->id; } public function store(BaseUser $user) { return $user->hasPermission('comments.create'); } public function update(BaseUser $user, ?Comment $comment = null) { return $user->hasPermission('comments.update') || ($comment && $comment->user_id === $user->id); } public function destroy(BaseUser $user, $commentIds) { if ($user->hasPermission('comments.delete')) { return true; } else { $dbCount = app(Comment::class) ->whereIn('id', $commentIds) ->where('user_id', $user->id) ->count(); dd($dbCount, $commentIds); return $dbCount === count($commentIds); } } }