diff --git a/src/Review.php b/src/Review.php index bba1b8c..de6ec87 100644 --- a/src/Review.php +++ b/src/Review.php @@ -2,10 +2,8 @@ namespace StarfolkSoftware\Gauge; -use Illuminate\Contracts\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; -use Illuminate\Database\Eloquent\Relations\MorphToMany; abstract class Review extends Model { @@ -34,7 +32,7 @@ abstract class Review extends Model /** * Returns the table name. - * + * * @return string */ public function getTable(): string @@ -54,7 +52,7 @@ public function team() /** * Returns the rewiewable. - * + * * @return \Illuminate\Database\Eloquent\Relations\MorphTo */ public function reviewable() @@ -64,11 +62,11 @@ public function reviewable() /** * Returns the user. - * + * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function user() { return $this->belongsTo(Gauge::userModel()); } -} \ No newline at end of file +} diff --git a/src/Reviewable.php b/src/Reviewable.php index c69716b..f124deb 100644 --- a/src/Reviewable.php +++ b/src/Reviewable.php @@ -8,11 +8,10 @@ trait Reviewable { /** * Leaves a review on the model. - * - * @param mixed $user - * @param int $rating - * @param string|null $comment - * + * + * @param mixed $user + * @param int $rating + * @param string|null $comment * @return void */ public function review($user, int $rating, $comment = null) @@ -38,7 +37,7 @@ public function review($user, int $rating, $comment = null) /** * Retrieves the reviews of the model. - * + * * @return \Illuminate\Database\Eloquent\Relations\morphMany */ public function reviews() @@ -48,7 +47,7 @@ public function reviews() /** * Returns the latest review. - * + * * @return \Illuminate\Database\Eloquent\Casts\Attribute */ public function latestReview(): Attribute @@ -58,7 +57,7 @@ public function latestReview(): Attribute /** * Calculates the avarage rating - * + * * @return \Illuminate\Database\Eloquent\Casts\Attribute */ public function averageRating(): Attribute @@ -68,7 +67,7 @@ public function averageRating(): Attribute /** * Calculates the total value of ratings - * + * * @return \Illuminate\Database\Eloquent\Casts\Attribute */ public function totalRating(): Attribute @@ -78,7 +77,7 @@ public function totalRating(): Attribute /** * Returns the reviews count - * + * * @return \Illuminate\Database\Eloquent\Casts\Attribute */ public function reviewsCount() @@ -88,11 +87,11 @@ public function reviewsCount() /** * Returns the count of the users that have rated. - * + * * @return \Illuminate\Database\Eloquent\Casts\Attribute */ public function usersCount() { return Attribute::make(fn () => $this->reviews()->groupBy('user_id')->pluck('user_id')->count()); } -} \ No newline at end of file +} diff --git a/src/TeamHasReviews.php b/src/TeamHasReviews.php index beba99a..01edd3d 100644 --- a/src/TeamHasReviews.php +++ b/src/TeamHasReviews.php @@ -13,4 +13,4 @@ public function reviews() { return $this->hasMany(Gauge::reviewModel(), 'team_id'); } -} \ No newline at end of file +} diff --git a/stubs/app/Models/Review.php b/stubs/app/Models/Review.php index a34ce9e..40d4592 100644 --- a/stubs/app/Models/Review.php +++ b/stubs/app/Models/Review.php @@ -6,5 +6,4 @@ class Review extends GaugeReview { - -} \ No newline at end of file +} diff --git a/stubs/app/Providers/GaugeServiceProvider.php b/stubs/app/Providers/GaugeServiceProvider.php index 7e02b49..276ff5c 100644 --- a/stubs/app/Providers/GaugeServiceProvider.php +++ b/stubs/app/Providers/GaugeServiceProvider.php @@ -23,6 +23,5 @@ public function register() */ public function boot() { - } -} \ No newline at end of file +} diff --git a/stubs/database/factories/ReviewFactory.php b/stubs/database/factories/ReviewFactory.php index 3e3bfa2..db43dea 100644 --- a/stubs/database/factories/ReviewFactory.php +++ b/stubs/database/factories/ReviewFactory.php @@ -14,10 +14,10 @@ public function definition() return [ 'team_id' => 1, 'user_id' => 1, - 'reviewable_type' => "App\\Models\\Item", + 'reviewable_type' => 'App\\Models\\Item', 'reviewable_id' => 1, 'rating' => 4, - 'comment' => $this->faker->paragraph() + 'comment' => $this->faker->paragraph(), ]; } } diff --git a/tests/Mocks/Item.php b/tests/Mocks/Item.php index 935bca3..ccdc9dd 100644 --- a/tests/Mocks/Item.php +++ b/tests/Mocks/Item.php @@ -12,4 +12,4 @@ class Item extends Model use Reviewable; protected $table = 'items'; -} \ No newline at end of file +} diff --git a/tests/Mocks/Review.php b/tests/Mocks/Review.php index 5d70545..71f8efa 100644 --- a/tests/Mocks/Review.php +++ b/tests/Mocks/Review.php @@ -15,4 +15,4 @@ protected static function newFactory() { return ReviewFactory::new(); } -} \ No newline at end of file +} diff --git a/tests/Mocks/ReviewFactory.php b/tests/Mocks/ReviewFactory.php index 95d945f..155510f 100644 --- a/tests/Mocks/ReviewFactory.php +++ b/tests/Mocks/ReviewFactory.php @@ -13,10 +13,10 @@ public function definition() return [ 'team_id' => 1, 'user_id' => 1, - 'reviewable_type' => "App\\Models\\Item", + 'reviewable_type' => 'App\\Models\\Item', 'reviewable_id' => 1, 'rating' => 4, - 'comment' => $this->faker->paragraph() + 'comment' => $this->faker->paragraph(), ]; } } diff --git a/tests/Mocks/Team.php b/tests/Mocks/Team.php index 823652d..d06e87e 100644 --- a/tests/Mocks/Team.php +++ b/tests/Mocks/Team.php @@ -10,4 +10,4 @@ class Team extends Model use TeamHasReviews; protected $table = 'teams'; -} \ No newline at end of file +} diff --git a/tests/Mocks/User.php b/tests/Mocks/User.php index bd9ac14..bca9fbb 100644 --- a/tests/Mocks/User.php +++ b/tests/Mocks/User.php @@ -7,4 +7,4 @@ class User extends AuthUser { protected $table = 'users'; -} \ No newline at end of file +} diff --git a/tests/ReviewTest.php b/tests/ReviewTest.php index e9768fe..678e282 100644 --- a/tests/ReviewTest.php +++ b/tests/ReviewTest.php @@ -15,4 +15,4 @@ $review = Review::factory()->create(); $this->assertSoftDeleted($review->fresh); -}); \ No newline at end of file +}); diff --git a/tests/TeamTest.php b/tests/TeamTest.php index 07ba8a6..6b75fd1 100644 --- a/tests/TeamTest.php +++ b/tests/TeamTest.php @@ -14,4 +14,4 @@ $team->reviews()->save($review); expect($team->fresh()->reviews()->count())->toBe(1); -}); \ No newline at end of file +}); diff --git a/tests/TestCase.php b/tests/TestCase.php index 13a8de2..f8dd610 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -4,7 +4,6 @@ use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Database\Schema\Blueprint; -use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Schema; use Orchestra\Testbench\TestCase as Orchestra; use StarfolkSoftware\Gauge\GaugeServiceProvider;