- Updated `Chat` and `ChatMessage` models for new table structures with UUIDs and attributes. - Integrated `ChatPolicy` for authorization checks. - Updated `ChatMessageController` with authorization and refined logic. - Adjusted routes and state in the frontend to handle chat IDs from the URL. - Enhanced `SocialMediaService` for handling chat-specific user prompts. - Removed unused migrations related to chats and chat messages.
48 lines
838 B
PHP
48 lines
838 B
PHP
<?php
|
|
|
|
namespace App\Policies;
|
|
|
|
use App\Models\Chat;
|
|
use App\Models\User;
|
|
use Illuminate\Auth\Access\HandlesAuthorization;
|
|
|
|
class ChatPolicy
|
|
{
|
|
use HandlesAuthorization;
|
|
|
|
public function viewAny(User $user): bool
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public function view(User $user, Chat $chat): bool
|
|
{
|
|
return $chat->user()->is($user);
|
|
}
|
|
|
|
public function create(User $user): bool
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public function update(User $user, Chat $chat): bool
|
|
{
|
|
return $chat->user()->is($user);
|
|
}
|
|
|
|
public function delete(User $user, Chat $chat): bool
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public function restore(User $user, Chat $chat): bool
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public function forceDelete(User $user, Chat $chat): bool
|
|
{
|
|
return false;
|
|
}
|
|
}
|