diff --git a/app/Models/Plan.php b/app/Models/Plan.php index d807a6e..9ca065f 100644 --- a/app/Models/Plan.php +++ b/app/Models/Plan.php @@ -32,6 +32,7 @@ use Spatie\Sluggable\SlugOptions; * @property \Illuminate\Support\Carbon|null $created_at * @property \Illuminate\Support\Carbon|null $updated_at * @property string $slug + * * @property-read \Illuminate\Database\Eloquent\Collection $author * @property-read int|null $author_count * @property-read \Illuminate\Database\Eloquent\Collection $comments diff --git a/app/Policies/PlanPolicy.php b/app/Policies/PlanPolicy.php index 536b452..94dca0a 100755 --- a/app/Policies/PlanPolicy.php +++ b/app/Policies/PlanPolicy.php @@ -14,6 +14,6 @@ class PlanPolicy private function isAuthorPlan(User $user, Plan $plan): bool { - return $user->id === $plan->author()->first()->id; + return $user->id === optional($plan->author()->first())->id; } } diff --git a/app/Rules/MinWords.php b/app/Rules/MinWords.php index 3a08281..cfb1c24 100644 --- a/app/Rules/MinWords.php +++ b/app/Rules/MinWords.php @@ -3,7 +3,6 @@ namespace App\Rules; use Closure; -use Illuminate\Contracts\Validation\Rule; use Illuminate\Contracts\Validation\ValidationRule; class MinWords implements ValidationRule