@@ -1,30 +1,30 @@ |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -namespace App\Models; |
|
| 3 | + namespace App\Models; |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Class UserCurrency. |
| 7 | 7 | */ |
| 8 | -class UserCurrency extends ChocolateyModel |
|
| 9 | -{ |
|
| 10 | - /** |
|
| 8 | + class UserCurrency extends ChocolateyModel |
|
| 9 | + { |
|
| 10 | + /** |
|
| 11 | 11 | * Disable Timestamps. |
| 12 | 12 | * |
| 13 | 13 | * @var bool |
| 14 | 14 | */ |
| 15 | - public $timestamps = false; |
|
| 15 | + public $timestamps = false; |
|
| 16 | 16 | |
| 17 | - /** |
|
| 17 | + /** |
|
| 18 | 18 | * The table associated with the model. |
| 19 | 19 | * |
| 20 | 20 | * @var string |
| 21 | 21 | */ |
| 22 | - protected $table = 'users_currency'; |
|
| 22 | + protected $table = 'users_currency'; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 24 | + /** |
|
| 25 | 25 | * Primary Key of the Table. |
| 26 | 26 | * |
| 27 | 27 | * @var string |
| 28 | 28 | */ |
| 29 | - protected $primaryKey = 'id'; |
|
| 29 | + protected $primaryKey = 'id'; |
|
| 30 | 30 | } |
@@ -1,30 +1,30 @@ |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -namespace App\Models; |
|
| 3 | + namespace App\Models; |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Class EmulatorSettings. |
| 7 | 7 | */ |
| 8 | -class EmulatorSettings extends ChocolateyModel |
|
| 9 | -{ |
|
| 10 | - /** |
|
| 8 | + class EmulatorSettings extends ChocolateyModel |
|
| 9 | + { |
|
| 10 | + /** |
|
| 11 | 11 | * Disable Timestamps. |
| 12 | 12 | * |
| 13 | 13 | * @var bool |
| 14 | 14 | */ |
| 15 | - public $timestamps = false; |
|
| 15 | + public $timestamps = false; |
|
| 16 | 16 | |
| 17 | - /** |
|
| 17 | + /** |
|
| 18 | 18 | * The table associated with the model. |
| 19 | 19 | * |
| 20 | 20 | * @var string |
| 21 | 21 | */ |
| 22 | - protected $table = 'emulator_settings'; |
|
| 22 | + protected $table = 'emulator_settings'; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 24 | + /** |
|
| 25 | 25 | * Primary Key of the Table. |
| 26 | 26 | * |
| 27 | 27 | * @var string |
| 28 | 28 | */ |
| 29 | - protected $primaryKey = 'id'; |
|
| 29 | + protected $primaryKey = 'id'; |
|
| 30 | 30 | } |
@@ -1,66 +1,66 @@ |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -namespace App\Models; |
|
| 3 | + namespace App\Models; |
|
| 4 | 4 | |
| 5 | -use Sofa\Eloquence\Eloquence; |
|
| 6 | -use Sofa\Eloquence\Mappable; |
|
| 5 | + use Sofa\Eloquence\Eloquence; |
|
| 6 | + use Sofa\Eloquence\Mappable; |
|
| 7 | 7 | |
| 8 | 8 | /** |
| 9 | 9 | * Class UserBadge. |
| 10 | 10 | */ |
| 11 | -class UserBadge extends ChocolateyModel |
|
| 12 | -{ |
|
| 13 | - use Eloquence, Mappable; |
|
| 11 | + class UserBadge extends ChocolateyModel |
|
| 12 | + { |
|
| 13 | + use Eloquence, Mappable; |
|
| 14 | 14 | |
| 15 | - /** |
|
| 15 | + /** |
|
| 16 | 16 | * Disable Timestamps. |
| 17 | 17 | * |
| 18 | 18 | * @var bool |
| 19 | 19 | */ |
| 20 | - public $timestamps = false; |
|
| 20 | + public $timestamps = false; |
|
| 21 | 21 | |
| 22 | - /** |
|
| 22 | + /** |
|
| 23 | 23 | * The table associated with the model. |
| 24 | 24 | * |
| 25 | 25 | * @var string |
| 26 | 26 | */ |
| 27 | - protected $table = 'users_badges'; |
|
| 27 | + protected $table = 'users_badges'; |
|
| 28 | 28 | |
| 29 | - /** |
|
| 29 | + /** |
|
| 30 | 30 | * Primary Key of the Table. |
| 31 | 31 | * |
| 32 | 32 | * @var string |
| 33 | 33 | */ |
| 34 | - protected $primaryKey = 'id'; |
|
| 34 | + protected $primaryKey = 'id'; |
|
| 35 | 35 | |
| 36 | - /** |
|
| 36 | + /** |
|
| 37 | 37 | * The attributes that will be mapped. |
| 38 | 38 | * |
| 39 | 39 | * @var array |
| 40 | 40 | */ |
| 41 | - protected $maps = ['badgeIndex' => 'slot_id', 'code' => 'badge_code', 'name' => 'badge_code']; |
|
| 41 | + protected $maps = ['badgeIndex' => 'slot_id', 'code' => 'badge_code', 'name' => 'badge_code']; |
|
| 42 | 42 | |
| 43 | - /** |
|
| 43 | + /** |
|
| 44 | 44 | * The attributes excluded from the model's JSON form. |
| 45 | 45 | * |
| 46 | 46 | * @var array |
| 47 | 47 | */ |
| 48 | - protected $hidden = ['user_id', 'badge_code', 'slot_id', 'id']; |
|
| 48 | + protected $hidden = ['user_id', 'badge_code', 'slot_id', 'id']; |
|
| 49 | 49 | |
| 50 | - /** |
|
| 50 | + /** |
|
| 51 | 51 | * The Appender(s) of the Model. |
| 52 | 52 | * |
| 53 | 53 | * @var array |
| 54 | 54 | */ |
| 55 | - protected $appends = ['description', 'badgeIndex', 'code', 'name']; |
|
| 55 | + protected $appends = ['description', 'badgeIndex', 'code', 'name']; |
|
| 56 | 56 | |
| 57 | - /** |
|
| 57 | + /** |
|
| 58 | 58 | * Get Description Attribute. |
| 59 | 59 | * |
| 60 | 60 | * @return string |
| 61 | 61 | */ |
| 62 | - public function getDescriptionAttribute(): string |
|
| 63 | - { |
|
| 64 | - return "Badge {$this->attributes['badge_code']}"; |
|
| 65 | - } |
|
| 62 | + public function getDescriptionAttribute(): string |
|
| 63 | + { |
|
| 64 | + return "Badge {$this->attributes['badge_code']}"; |
|
| 65 | + } |
|
| 66 | 66 | } |
@@ -1,30 +1,30 @@ |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -namespace App\Models; |
|
| 3 | + namespace App\Models; |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Class PaymentCheckout. |
| 7 | 7 | */ |
| 8 | -class PaymentCheckout extends ChocolateyModel |
|
| 9 | -{ |
|
| 10 | - /** |
|
| 8 | + class PaymentCheckout extends ChocolateyModel |
|
| 9 | + { |
|
| 10 | + /** |
|
| 11 | 11 | * Disable Timestamps. |
| 12 | 12 | * |
| 13 | 13 | * @var bool |
| 14 | 14 | */ |
| 15 | - public $timestamps = false; |
|
| 15 | + public $timestamps = false; |
|
| 16 | 16 | |
| 17 | - /** |
|
| 17 | + /** |
|
| 18 | 18 | * The table associated with the model. |
| 19 | 19 | * |
| 20 | 20 | * @var string |
| 21 | 21 | */ |
| 22 | - protected $table = 'chocolatey_shop_payment_checkout'; |
|
| 22 | + protected $table = 'chocolatey_shop_payment_checkout'; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 24 | + /** |
|
| 25 | 25 | * Primary Key of the Table. |
| 26 | 26 | * |
| 27 | 27 | * @var string |
| 28 | 28 | */ |
| 29 | - protected $primaryKey = 'id'; |
|
| 29 | + protected $primaryKey = 'id'; |
|
| 30 | 30 | } |
@@ -1,66 +1,66 @@ |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -namespace App\Models; |
|
| 3 | + namespace App\Models; |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Class GroupMember. |
| 7 | 7 | */ |
| 8 | -class GroupMember extends ChocolateyModel |
|
| 9 | -{ |
|
| 10 | - /** |
|
| 8 | + class GroupMember extends ChocolateyModel |
|
| 9 | + { |
|
| 10 | + /** |
|
| 11 | 11 | * Disable Timestamps. |
| 12 | 12 | * |
| 13 | 13 | * @var bool |
| 14 | 14 | */ |
| 15 | - public $timestamps = false; |
|
| 15 | + public $timestamps = false; |
|
| 16 | 16 | |
| 17 | - /** |
|
| 17 | + /** |
|
| 18 | 18 | * The table associated with the model. |
| 19 | 19 | * |
| 20 | 20 | * @var string |
| 21 | 21 | */ |
| 22 | - protected $table = 'guilds_members'; |
|
| 22 | + protected $table = 'guilds_members'; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 24 | + /** |
|
| 25 | 25 | * Primary Key of the Table. |
| 26 | 26 | * |
| 27 | 27 | * @var string |
| 28 | 28 | */ |
| 29 | - protected $primaryKey = 'id'; |
|
| 29 | + protected $primaryKey = 'id'; |
|
| 30 | 30 | |
| 31 | - /** |
|
| 31 | + /** |
|
| 32 | 32 | * The attributes excluded from the model's JSON form. |
| 33 | 33 | * |
| 34 | 34 | * @var array |
| 35 | 35 | */ |
| 36 | - protected $hidden = ['id', 'member_since', 'guild_id', 'level_id', 'user_id']; |
|
| 36 | + protected $hidden = ['id', 'member_since', 'guild_id', 'level_id', 'user_id']; |
|
| 37 | 37 | |
| 38 | - /** |
|
| 38 | + /** |
|
| 39 | 39 | * The Appender(s) of the Model. |
| 40 | 40 | * |
| 41 | 41 | * @var array |
| 42 | 42 | */ |
| 43 | - protected $appends = ['guild']; |
|
| 43 | + protected $appends = ['guild']; |
|
| 44 | 44 | |
| 45 | - /** |
|
| 45 | + /** |
|
| 46 | 46 | * Get User Group by Member Group Id. |
| 47 | 47 | * |
| 48 | 48 | * @return UserGroup |
| 49 | 49 | */ |
| 50 | - public function getGuildAttribute(): UserGroup |
|
| 51 | - { |
|
| 52 | - return UserGroup::find($this->attributes['guild_id']); |
|
| 53 | - } |
|
| 50 | + public function getGuildAttribute(): UserGroup |
|
| 51 | + { |
|
| 52 | + return UserGroup::find($this->attributes['guild_id']); |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - /** |
|
| 55 | + /** |
|
| 56 | 56 | * Get Description Attribute. |
| 57 | 57 | * |
| 58 | 58 | * @TODO: Get Real Badge Description |
| 59 | 59 | * |
| 60 | 60 | * @return string |
| 61 | 61 | */ |
| 62 | - public function getDescriptionAttribute(): string |
|
| 63 | - { |
|
| 64 | - return "Badge {$this->attributes['badge_code']}"; |
|
| 65 | - } |
|
| 62 | + public function getDescriptionAttribute(): string |
|
| 63 | + { |
|
| 64 | + return "Badge {$this->attributes['badge_code']}"; |
|
| 65 | + } |
|
| 66 | 66 | } |
@@ -1,30 +1,30 @@ |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -namespace App\Models; |
|
| 3 | + namespace App\Models; |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Class Voucher. |
| 7 | 7 | */ |
| 8 | -class Voucher extends ChocolateyModel |
|
| 9 | -{ |
|
| 10 | - /** |
|
| 8 | + class Voucher extends ChocolateyModel |
|
| 9 | + { |
|
| 10 | + /** |
|
| 11 | 11 | * Disable Timestamps. |
| 12 | 12 | * |
| 13 | 13 | * @var bool |
| 14 | 14 | */ |
| 15 | - public $timestamps = false; |
|
| 15 | + public $timestamps = false; |
|
| 16 | 16 | |
| 17 | - /** |
|
| 17 | + /** |
|
| 18 | 18 | * The table associated with the model. |
| 19 | 19 | * |
| 20 | 20 | * @var string |
| 21 | 21 | */ |
| 22 | - protected $table = 'vouchers'; |
|
| 22 | + protected $table = 'vouchers'; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 24 | + /** |
|
| 25 | 25 | * Primary Key of the Table. |
| 26 | 26 | * |
| 27 | 27 | * @var string |
| 28 | 28 | */ |
| 29 | - protected $primaryKey = 'id'; |
|
| 29 | + protected $primaryKey = 'id'; |
|
| 30 | 30 | } |
@@ -1,44 +1,44 @@ |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -namespace App\Models; |
|
| 3 | + namespace App\Models; |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Class PurchaseParam. |
| 7 | 7 | */ |
| 8 | -class PurchaseParam |
|
| 9 | -{ |
|
| 10 | - /** |
|
| 8 | + class PurchaseParam |
|
| 9 | + { |
|
| 10 | + /** |
|
| 11 | 11 | * Country Id. |
| 12 | 12 | * |
| 13 | 13 | * @var int |
| 14 | 14 | */ |
| 15 | - public $countryId; |
|
| 15 | + public $countryId; |
|
| 16 | 16 | |
| 17 | - /** |
|
| 17 | + /** |
|
| 18 | 18 | * Price Point Id. |
| 19 | 19 | * |
| 20 | 20 | * @var int |
| 21 | 21 | */ |
| 22 | - public $pricePointId; |
|
| 22 | + public $pricePointId; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 24 | + /** |
|
| 25 | 25 | * Payment Method Id. |
| 26 | 26 | * |
| 27 | 27 | * @var int |
| 28 | 28 | */ |
| 29 | - public $paymentMethodId; |
|
| 29 | + public $paymentMethodId; |
|
| 30 | 30 | |
| 31 | - /** |
|
| 31 | + /** |
|
| 32 | 32 | * Create a new Purchase Param. |
| 33 | 33 | * |
| 34 | 34 | * @param int $countryId |
| 35 | 35 | * @param int $pricePointId |
| 36 | 36 | * @param int $paymentMethodId |
| 37 | 37 | */ |
| 38 | - public function __construct(int $countryId, int $pricePointId, int $paymentMethodId) |
|
| 39 | - { |
|
| 40 | - $this->countryId = $countryId; |
|
| 41 | - $this->pricePointId = $pricePointId; |
|
| 42 | - $this->paymentMethodId = $paymentMethodId; |
|
| 43 | - } |
|
| 38 | + public function __construct(int $countryId, int $pricePointId, int $paymentMethodId) |
|
| 39 | + { |
|
| 40 | + $this->countryId = $countryId; |
|
| 41 | + $this->pricePointId = $pricePointId; |
|
| 42 | + $this->paymentMethodId = $paymentMethodId; |
|
| 43 | + } |
|
| 44 | 44 | } |
@@ -1,80 +1,80 @@ |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -namespace App\Models; |
|
| 3 | + namespace App\Models; |
|
| 4 | 4 | |
| 5 | -use Sofa\Eloquence\Eloquence; |
|
| 6 | -use Sofa\Eloquence\Mappable; |
|
| 5 | + use Sofa\Eloquence\Eloquence; |
|
| 6 | + use Sofa\Eloquence\Mappable; |
|
| 7 | 7 | |
| 8 | 8 | /** |
| 9 | 9 | * Class UserGroup. |
| 10 | 10 | */ |
| 11 | -class UserGroup extends ChocolateyModel |
|
| 12 | -{ |
|
| 13 | - use Eloquence, Mappable; |
|
| 11 | + class UserGroup extends ChocolateyModel |
|
| 12 | + { |
|
| 13 | + use Eloquence, Mappable; |
|
| 14 | 14 | |
| 15 | - /** |
|
| 15 | + /** |
|
| 16 | 16 | * Disable Timestamps. |
| 17 | 17 | * |
| 18 | 18 | * @var bool |
| 19 | 19 | */ |
| 20 | - public $timestamps = false; |
|
| 20 | + public $timestamps = false; |
|
| 21 | 21 | |
| 22 | - /** |
|
| 22 | + /** |
|
| 23 | 23 | * The table associated with the model. |
| 24 | 24 | * |
| 25 | 25 | * @var string |
| 26 | 26 | */ |
| 27 | - protected $table = 'guilds'; |
|
| 27 | + protected $table = 'guilds'; |
|
| 28 | 28 | |
| 29 | - /** |
|
| 29 | + /** |
|
| 30 | 30 | * Primary Key of the Table. |
| 31 | 31 | * |
| 32 | 32 | * @var string |
| 33 | 33 | */ |
| 34 | - protected $primaryKey = 'id'; |
|
| 34 | + protected $primaryKey = 'id'; |
|
| 35 | 35 | |
| 36 | - /** |
|
| 36 | + /** |
|
| 37 | 37 | * The attributes that will be mapped. |
| 38 | 38 | * |
| 39 | 39 | * @var array |
| 40 | 40 | */ |
| 41 | - protected $maps = ['badgeCode' => 'badge', 'roomId' => 'room_id', 'primaryColour' => 'color_one', 'secondaryColour' => 'color_two']; |
|
| 41 | + protected $maps = ['badgeCode' => 'badge', 'roomId' => 'room_id', 'primaryColour' => 'color_one', 'secondaryColour' => 'color_two']; |
|
| 42 | 42 | |
| 43 | - /** |
|
| 43 | + /** |
|
| 44 | 44 | * The attributes excluded from the model's JSON form. |
| 45 | 45 | * |
| 46 | 46 | * @var array |
| 47 | 47 | */ |
| 48 | - protected $hidden = ['user_id', 'badge', 'slot_id', 'id', 'user_id', 'room_id', 'state', 'rights', 'forum', 'date_created', 'read_forum', 'post_messages', 'post_threads', 'mod_forum']; |
|
| 48 | + protected $hidden = ['user_id', 'badge', 'slot_id', 'id', 'user_id', 'room_id', 'state', 'rights', 'forum', 'date_created', 'read_forum', 'post_messages', 'post_threads', 'mod_forum']; |
|
| 49 | 49 | |
| 50 | - /** |
|
| 50 | + /** |
|
| 51 | 51 | * The Appender(s) of the Model. |
| 52 | 52 | * |
| 53 | 53 | * @var array |
| 54 | 54 | */ |
| 55 | - protected $appends = ['badgeCode', 'roomId', 'primaryColour', 'secondaryColour', 'type', 'isAdmin']; |
|
| 55 | + protected $appends = ['badgeCode', 'roomId', 'primaryColour', 'secondaryColour', 'type', 'isAdmin']; |
|
| 56 | 56 | |
| 57 | - /** |
|
| 57 | + /** |
|
| 58 | 58 | * Return if is Admin. |
| 59 | 59 | * |
| 60 | 60 | * @TODO: Link with User Data |
| 61 | 61 | * |
| 62 | 62 | * @return bool |
| 63 | 63 | */ |
| 64 | - public function getIsAdminAttribute(): bool |
|
| 65 | - { |
|
| 66 | - return false; |
|
| 67 | - } |
|
| 64 | + public function getIsAdminAttribute(): bool |
|
| 65 | + { |
|
| 66 | + return false; |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - /** |
|
| 69 | + /** |
|
| 70 | 70 | * Get the Group Type. |
| 71 | 71 | * |
| 72 | 72 | * @TODO: What NORMAL means? |
| 73 | 73 | * |
| 74 | 74 | * @return string |
| 75 | 75 | */ |
| 76 | - public function getTypeAttribute(): string |
|
| 77 | - { |
|
| 78 | - return 'NORMAL'; |
|
| 79 | - } |
|
| 76 | + public function getTypeAttribute(): string |
|
| 77 | + { |
|
| 78 | + return 'NORMAL'; |
|
| 79 | + } |
|
| 80 | 80 | } |
@@ -1,34 +1,34 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -namespace App\Http\Controllers; |
|
| 3 | + namespace App\Http\Controllers; |
|
| 4 | 4 | |
| 5 | -use App\Facades\User as UserFacade; |
|
| 6 | -use App\Models\Photo; |
|
| 7 | -use App\Models\PhotoLike; |
|
| 8 | -use App\Models\PhotoReport; |
|
| 9 | -use Illuminate\Http\JsonResponse; |
|
| 10 | -use Illuminate\Http\Request; |
|
| 11 | -use Illuminate\Http\Response; |
|
| 12 | -use Laravel\Lumen\Routing\Controller as BaseController; |
|
| 5 | + use App\Facades\User as UserFacade; |
|
| 6 | + use App\Models\Photo; |
|
| 7 | + use App\Models\PhotoLike; |
|
| 8 | + use App\Models\PhotoReport; |
|
| 9 | + use Illuminate\Http\JsonResponse; |
|
| 10 | + use Illuminate\Http\Request; |
|
| 11 | + use Illuminate\Http\Response; |
|
| 12 | + use Laravel\Lumen\Routing\Controller as BaseController; |
|
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | 15 | * Class PhotosController. |
| 16 | 16 | */ |
| 17 | -class PhotosController extends BaseController |
|
| 18 | -{ |
|
| 19 | - /** |
|
| 17 | + class PhotosController extends BaseController |
|
| 18 | + { |
|
| 19 | + /** |
|
| 20 | 20 | * Render a set of Public HabboWEB Photos. |
| 21 | 21 | * |
| 22 | 22 | * @TODO: Exclude Approved Reported Photos from the List |
| 23 | 23 | * |
| 24 | 24 | * @return JsonResponse |
| 25 | 25 | */ |
| 26 | - public function show(): JsonResponse |
|
| 27 | - { |
|
| 28 | - return response()->json(Photo::all(), 200, [], JSON_UNESCAPED_SLASHES); |
|
| 29 | - } |
|
| 26 | + public function show(): JsonResponse |
|
| 27 | + { |
|
| 28 | + return response()->json(Photo::all(), 200, [], JSON_UNESCAPED_SLASHES); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - /** |
|
| 31 | + /** |
|
| 32 | 32 | * Register a Report of a Photo |
| 33 | 33 | * Observation.: We will not create a limit of max reports. |
| 34 | 34 | * Since it's a retro we don't really care about reports. |
@@ -40,66 +40,66 @@ discard block |
||
| 40 | 40 | * |
| 41 | 41 | * @return Response |
| 42 | 42 | */ |
| 43 | - public function report(Request $request, int $photoId): Response |
|
| 44 | - { |
|
| 45 | - (new PhotoReport())->store($photoId, $request->json()->get('reason'), UserFacade::getUser()->uniqueId); |
|
| 43 | + public function report(Request $request, int $photoId): Response |
|
| 44 | + { |
|
| 45 | + (new PhotoReport())->store($photoId, $request->json()->get('reason'), UserFacade::getUser()->uniqueId); |
|
| 46 | 46 | |
| 47 | - return response(null); |
|
| 48 | - } |
|
| 47 | + return response(null); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - /** |
|
| 50 | + /** |
|
| 51 | 51 | * Like a Photo. |
| 52 | 52 | * |
| 53 | 53 | * @param int $photoId |
| 54 | 54 | * |
| 55 | 55 | * @return Response |
| 56 | 56 | */ |
| 57 | - public function likePhoto(int $photoId): Response |
|
| 58 | - { |
|
| 59 | - if (PhotoLike::where('username', UserFacade::getUser()->name)->where('photo_id', $photoId)->count() > 0) { |
|
| 60 | - return response(null); |
|
| 61 | - } |
|
| 57 | + public function likePhoto(int $photoId): Response |
|
| 58 | + { |
|
| 59 | + if (PhotoLike::where('username', UserFacade::getUser()->name)->where('photo_id', $photoId)->count() > 0) { |
|
| 60 | + return response(null); |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - (new PhotoLike())->store($photoId, UserFacade::getUser()->name); |
|
| 63 | + (new PhotoLike())->store($photoId, UserFacade::getUser()->name); |
|
| 64 | 64 | |
| 65 | - return response(null); |
|
| 66 | - } |
|
| 65 | + return response(null); |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - /** |
|
| 68 | + /** |
|
| 69 | 69 | * Unlike a Photo. |
| 70 | 70 | * |
| 71 | 71 | * @param int $photoId |
| 72 | 72 | * |
| 73 | 73 | * @return Response |
| 74 | 74 | */ |
| 75 | - public function unlikePhoto(int $photoId): Response |
|
| 76 | - { |
|
| 77 | - if (PhotoLike::where('username', UserFacade::getUser()->name)->where('photo_id', $photoId)->count() == 0) { |
|
| 78 | - return response(null); |
|
| 79 | - } |
|
| 75 | + public function unlikePhoto(int $photoId): Response |
|
| 76 | + { |
|
| 77 | + if (PhotoLike::where('username', UserFacade::getUser()->name)->where('photo_id', $photoId)->count() == 0) { |
|
| 78 | + return response(null); |
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | - PhotoLike::where('username', UserFacade::getUser()->name)->where('photo_id', $photoId)->delete(); |
|
| 81 | + PhotoLike::where('username', UserFacade::getUser()->name)->where('photo_id', $photoId)->delete(); |
|
| 82 | 82 | |
| 83 | - return response(null); |
|
| 84 | - } |
|
| 83 | + return response(null); |
|
| 84 | + } |
|
| 85 | 85 | |
| 86 | - /** |
|
| 86 | + /** |
|
| 87 | 87 | * Delete a Photo. |
| 88 | 88 | * |
| 89 | 89 | * @param int $photoId |
| 90 | 90 | * |
| 91 | 91 | * @return Response |
| 92 | 92 | */ |
| 93 | - public function delete(int $photoId): Response |
|
| 94 | - { |
|
| 95 | - $photo = Photo::find($photoId); |
|
| 93 | + public function delete(int $photoId): Response |
|
| 94 | + { |
|
| 95 | + $photo = Photo::find($photoId); |
|
| 96 | 96 | |
| 97 | - if ($photo == null || $photo->creator_id != UserFacade::getUser()->uniqueId) { |
|
| 98 | - return response(null, 401); |
|
| 99 | - } |
|
| 97 | + if ($photo == null || $photo->creator_id != UserFacade::getUser()->uniqueId) { |
|
| 98 | + return response(null, 401); |
|
| 99 | + } |
|
| 100 | 100 | |
| 101 | - $photo->delete(); |
|
| 101 | + $photo->delete(); |
|
| 102 | 102 | |
| 103 | - return response(null); |
|
| 104 | - } |
|
| 103 | + return response(null); |
|
| 104 | + } |
|
| 105 | 105 | } |