laravel-learn-bbs/app/Policies/ReplyPolicy.php

21 lines
392 B
PHP
Raw Permalink Normal View History

2018-01-15 15:24:11 +00:00
<?php
namespace App\Policies;
use App\Models\Reply;
use App\Models\User;
class ReplyPolicy extends Policy
{
public function update(User $user, Reply $reply)
{
// return $reply->user_id == $user->id;
return true;
}
public function destroy(User $user, Reply $reply)
{
2018-01-31 15:00:57 +00:00
return $user->isAuthorOf($reply) || $user->isAuthorOf($reply->topic);
2018-01-15 15:24:11 +00:00
}
}