-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
1,680 additions
and
535 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace App\Policies; | ||
|
||
use App\Comment; | ||
use App\User; | ||
|
||
class CommentPolicy | ||
{ | ||
/** | ||
* Determine if the given comment can be updated by the user. | ||
* | ||
* @param User $user | ||
* @param Comment $comment | ||
* @return bool | ||
*/ | ||
public function update(User $user, Comment $comment) | ||
{ | ||
return $user->id === $comment->user_id; | ||
} | ||
|
||
/** | ||
* Determine if the given comment can be deleted by the user. | ||
* | ||
* @param User $user | ||
* @param Comment $comment | ||
* @return bool | ||
*/ | ||
public function delete(User $user, Comment $comment) | ||
{ | ||
return $user->id === $comment->user_id; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace App\Policies; | ||
|
||
use App\Post; | ||
use App\User; | ||
|
||
class PostPolicy | ||
{ | ||
/** | ||
* Determine if the given post can be updated by the user. | ||
* | ||
* @param User $user | ||
* @param Post $post | ||
* @return bool | ||
*/ | ||
public function update(User $user, Post $post) | ||
{ | ||
return $user->id === $post->user_id; | ||
} | ||
|
||
/** | ||
* Determine if the given post can be deleted by the user. | ||
* | ||
* @param User $user | ||
* @param Post $post | ||
* @return bool | ||
*/ | ||
public function delete(User $user, Post $post) | ||
{ | ||
return $user->id === $post->user_id; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.