@@ -1,34 +1,34 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -namespace App\Models; |
|
| 3 | + namespace App\Models; |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Class RoomItem. |
| 7 | 7 | */ |
| 8 | -class RoomItem extends ChocolateyModel |
|
| 9 | -{ |
|
| 10 | - /** |
|
| 8 | + class RoomItem 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 = 'items'; |
|
| 22 | + protected $table = 'items'; |
|
| 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 | * Store a RoomItem. |
| 33 | 33 | * |
| 34 | 34 | * @param int $userId |
@@ -43,24 +43,24 @@ discard block |
||
| 43 | 43 | * |
| 44 | 44 | * @return RoomItem |
| 45 | 45 | */ |
| 46 | - public function store(int $userId, int $roomId, int $itemId, int $xPosition, int $yPosition, string $zPosition, int $rotation, string $extraData, string $wallPosition = ''): RoomItem |
|
| 47 | - { |
|
| 48 | - $this->attributes['user_id'] = $userId; |
|
| 49 | - $this->attributes['room_id'] = $roomId; |
|
| 50 | - $this->attributes['item_id'] = $itemId; |
|
| 51 | - $this->attributes['x'] = $xPosition; |
|
| 52 | - $this->attributes['y'] = $yPosition; |
|
| 53 | - $this->attributes['z'] = $zPosition; |
|
| 54 | - $this->attributes['rot'] = $rotation; |
|
| 55 | - $this->attributes['extra_data'] = $extraData; |
|
| 56 | - $this->timestamps = false; |
|
| 46 | + public function store(int $userId, int $roomId, int $itemId, int $xPosition, int $yPosition, string $zPosition, int $rotation, string $extraData, string $wallPosition = ''): RoomItem |
|
| 47 | + { |
|
| 48 | + $this->attributes['user_id'] = $userId; |
|
| 49 | + $this->attributes['room_id'] = $roomId; |
|
| 50 | + $this->attributes['item_id'] = $itemId; |
|
| 51 | + $this->attributes['x'] = $xPosition; |
|
| 52 | + $this->attributes['y'] = $yPosition; |
|
| 53 | + $this->attributes['z'] = $zPosition; |
|
| 54 | + $this->attributes['rot'] = $rotation; |
|
| 55 | + $this->attributes['extra_data'] = $extraData; |
|
| 56 | + $this->timestamps = false; |
|
| 57 | 57 | |
| 58 | - if (!empty($wallPosition)) { |
|
| 59 | - $this->attributes['wall_pos'] = $wallPosition; |
|
| 60 | - } |
|
| 58 | + if (!empty($wallPosition)) { |
|
| 59 | + $this->attributes['wall_pos'] = $wallPosition; |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - $this->save(); |
|
| 62 | + $this->save(); |
|
| 63 | 63 | |
| 64 | - return $this; |
|
| 65 | - } |
|
| 64 | + return $this; |
|
| 65 | + } |
|
| 66 | 66 | } |
@@ -1,69 +1,69 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -namespace App\Models; |
|
| 3 | + namespace App\Models; |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Class UserSecurity. |
| 7 | 7 | */ |
| 8 | -class UserSecurity extends ChocolateyModel |
|
| 9 | -{ |
|
| 10 | - /** |
|
| 8 | + class UserSecurity 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_users_security'; |
|
| 22 | + protected $table = 'chocolatey_users_security'; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 24 | + /** |
|
| 25 | 25 | * Primary Key of the Table. |
| 26 | 26 | * |
| 27 | 27 | * @var string |
| 28 | 28 | */ |
| 29 | - protected $primaryKey = 'user_id'; |
|
| 29 | + protected $primaryKey = 'user_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 = ['user_id']; |
|
| 36 | + protected $hidden = ['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 = [ |
|
| 44 | - 'trustedDevices', |
|
| 45 | - ]; |
|
| 43 | + protected $appends = [ |
|
| 44 | + 'trustedDevices', |
|
| 45 | + ]; |
|
| 46 | 46 | |
| 47 | - /** |
|
| 47 | + /** |
|
| 48 | 48 | * The attributes that are mass assignable. |
| 49 | 49 | * |
| 50 | 50 | * @var array |
| 51 | 51 | */ |
| 52 | - protected $fillable = ['user_id', 'firstQuestion', 'secondQuestion', 'firstAnswer', 'secondAnswer']; |
|
| 52 | + protected $fillable = ['user_id', 'firstQuestion', 'secondQuestion', 'firstAnswer', 'secondAnswer']; |
|
| 53 | 53 | |
| 54 | - /** |
|
| 54 | + /** |
|
| 55 | 55 | * Get Trusted Devices. |
| 56 | 56 | * |
| 57 | 57 | * @return array |
| 58 | 58 | */ |
| 59 | - public function getTrustedDevicesAttribute(): array |
|
| 60 | - { |
|
| 61 | - return TrustedDevice::where('user_id', $this->attributes['user_id'])->get(['ip_address'])->map(function ($item) { |
|
| 62 | - return $item->ip_address; |
|
| 63 | - })->toArray(); |
|
| 64 | - } |
|
| 59 | + public function getTrustedDevicesAttribute(): array |
|
| 60 | + { |
|
| 61 | + return TrustedDevice::where('user_id', $this->attributes['user_id'])->get(['ip_address'])->map(function ($item) { |
|
| 62 | + return $item->ip_address; |
|
| 63 | + })->toArray(); |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - /** |
|
| 66 | + /** |
|
| 67 | 67 | * Store a new User Security Metadata. |
| 68 | 68 | * |
| 69 | 69 | * @param int $userId |
@@ -74,15 +74,15 @@ discard block |
||
| 74 | 74 | * |
| 75 | 75 | * @return UserSecurity |
| 76 | 76 | */ |
| 77 | - public function store(int $userId, int $firstQuestion, int $secondQuestion, string $firstAnswer, string $secondAnswer): UserSecurity |
|
| 78 | - { |
|
| 79 | - $this->attributes['user_id'] = $userId; |
|
| 80 | - $this->attributes['firstQuestion'] = $firstQuestion; |
|
| 81 | - $this->attributes['secondQuestion'] = $secondQuestion; |
|
| 82 | - $this->attributes['firstAnswer'] = $firstAnswer; |
|
| 83 | - $this->attributes['secondAnswer'] = $secondAnswer; |
|
| 84 | - $this->timestamps = false; |
|
| 77 | + public function store(int $userId, int $firstQuestion, int $secondQuestion, string $firstAnswer, string $secondAnswer): UserSecurity |
|
| 78 | + { |
|
| 79 | + $this->attributes['user_id'] = $userId; |
|
| 80 | + $this->attributes['firstQuestion'] = $firstQuestion; |
|
| 81 | + $this->attributes['secondQuestion'] = $secondQuestion; |
|
| 82 | + $this->attributes['firstAnswer'] = $firstAnswer; |
|
| 83 | + $this->attributes['secondAnswer'] = $secondAnswer; |
|
| 84 | + $this->timestamps = false; |
|
| 85 | 85 | |
| 86 | - return $this; |
|
| 87 | - } |
|
| 86 | + return $this; |
|
| 87 | + } |
|
| 88 | 88 | } |
@@ -1,34 +1,34 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -namespace App\Models; |
|
| 3 | + namespace App\Models; |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Class PhotoReportCategory. |
| 7 | 7 | */ |
| 8 | -class PhotoReportCategory extends ChocolateyModel |
|
| 9 | -{ |
|
| 10 | - /** |
|
| 8 | + class PhotoReportCategory 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_users_photos_reported_categories'; |
|
| 22 | + protected $table = 'chocolatey_users_photos_reported_categories'; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 24 | + /** |
|
| 25 | 25 | * Primary Key of the Table. |
| 26 | 26 | * |
| 27 | 27 | * @var string |
| 28 | 28 | */ |
| 29 | - protected $primaryKey = 'reported_category'; |
|
| 29 | + protected $primaryKey = 'reported_category'; |
|
| 30 | 30 | |
| 31 | - /** |
|
| 31 | + /** |
|
| 32 | 32 | * Add a Report Category. |
| 33 | 33 | * |
| 34 | 34 | * @param int $reportCategory |
@@ -36,14 +36,14 @@ discard block |
||
| 36 | 36 | * |
| 37 | 37 | * @return PhotoReportCategory |
| 38 | 38 | */ |
| 39 | - public function store(int $reportCategory, string $description): PhotoReportCategory |
|
| 40 | - { |
|
| 41 | - $this->attributes['report_category'] = $reportCategory; |
|
| 42 | - $this->attributes['description'] = $description; |
|
| 43 | - $this->timestamps = false; |
|
| 39 | + public function store(int $reportCategory, string $description): PhotoReportCategory |
|
| 40 | + { |
|
| 41 | + $this->attributes['report_category'] = $reportCategory; |
|
| 42 | + $this->attributes['description'] = $description; |
|
| 43 | + $this->timestamps = false; |
|
| 44 | 44 | |
| 45 | - $this->save(); |
|
| 45 | + $this->save(); |
|
| 46 | 46 | |
| 47 | - return $this; |
|
| 48 | - } |
|
| 47 | + return $this; |
|
| 48 | + } |
|
| 49 | 49 | } |
@@ -1,32 +1,32 @@ |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -namespace App\Models; |
|
| 3 | + namespace App\Models; |
|
| 4 | 4 | |
| 5 | -use Illuminate\Database\Eloquent\Model; |
|
| 5 | + use Illuminate\Database\Eloquent\Model; |
|
| 6 | 6 | |
| 7 | 7 | /** |
| 8 | 8 | * Class ChocolateyModel. |
| 9 | 9 | */ |
| 10 | -abstract class ChocolateyModel extends Model |
|
| 11 | -{ |
|
| 12 | - /** |
|
| 10 | + abstract class ChocolateyModel extends Model |
|
| 11 | + { |
|
| 12 | + /** |
|
| 13 | 13 | * Remove Useless Updated At. |
| 14 | 14 | * |
| 15 | 15 | * @return null |
| 16 | 16 | */ |
| 17 | - public function getUpdatedAtColumn() |
|
| 18 | - { |
|
| 19 | - } |
|
| 17 | + public function getUpdatedAtColumn() |
|
| 18 | + { |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | - /** |
|
| 21 | + /** |
|
| 22 | 22 | * Remove Useless Updated At. |
| 23 | 23 | * |
| 24 | 24 | * @param mixed $value |
| 25 | 25 | * |
| 26 | 26 | * @return $this |
| 27 | 27 | */ |
| 28 | - public function setUpdatedAt($value) |
|
| 29 | - { |
|
| 30 | - return $this; |
|
| 31 | - } |
|
| 28 | + public function setUpdatedAt($value) |
|
| 29 | + { |
|
| 30 | + return $this; |
|
| 31 | + } |
|
| 32 | 32 | } |
@@ -1,53 +1,53 @@ discard block |
||
| 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 Article. |
| 10 | 10 | */ |
| 11 | -class Article extends ChocolateyModel |
|
| 12 | -{ |
|
| 13 | - use Eloquence, Mappable; |
|
| 11 | + class Article extends ChocolateyModel |
|
| 12 | + { |
|
| 13 | + use Eloquence, Mappable; |
|
| 14 | 14 | |
| 15 | - /** |
|
| 15 | + /** |
|
| 16 | 16 | * The table associated with the model. |
| 17 | 17 | * |
| 18 | 18 | * @var string |
| 19 | 19 | */ |
| 20 | - protected $table = 'chocolatey_articles'; |
|
| 20 | + protected $table = 'chocolatey_articles'; |
|
| 21 | 21 | |
| 22 | - /** |
|
| 22 | + /** |
|
| 23 | 23 | * Primary Key of the Table. |
| 24 | 24 | * |
| 25 | 25 | * @var string |
| 26 | 26 | */ |
| 27 | - protected $primaryKey = 'id'; |
|
| 27 | + protected $primaryKey = 'id'; |
|
| 28 | 28 | |
| 29 | - /** |
|
| 29 | + /** |
|
| 30 | 30 | * The attributes that will be mapped. |
| 31 | 31 | * |
| 32 | 32 | * @var array |
| 33 | 33 | */ |
| 34 | - protected $maps = ['updatedAt' => 'updated_at', 'createdAt' => 'created_at']; |
|
| 34 | + protected $maps = ['updatedAt' => 'updated_at', 'createdAt' => 'created_at']; |
|
| 35 | 35 | |
| 36 | - /** |
|
| 36 | + /** |
|
| 37 | 37 | * The Appender(s) of the Model. |
| 38 | 38 | * |
| 39 | 39 | * @var array |
| 40 | 40 | */ |
| 41 | - protected $appends = ['updatedAt', 'createdAt']; |
|
| 41 | + protected $appends = ['updatedAt', 'createdAt']; |
|
| 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 = ['updated_at', 'created_at']; |
|
| 48 | + protected $hidden = ['updated_at', 'created_at']; |
|
| 49 | 49 | |
| 50 | - /** |
|
| 50 | + /** |
|
| 51 | 51 | * Store a new CMS Article. |
| 52 | 52 | * |
| 53 | 53 | * @param string $title |
@@ -60,34 +60,34 @@ discard block |
||
| 60 | 60 | * |
| 61 | 61 | * @return Article |
| 62 | 62 | */ |
| 63 | - public function store(string $title, string $description, string $content, string $author, string $categories, string $imageUrl, string $thumbnailUrl): Article |
|
| 64 | - { |
|
| 65 | - $this->attributes['title'] = $title; |
|
| 66 | - $this->attributes['description'] = $description; |
|
| 67 | - $this->attributes['content'] = $content; |
|
| 68 | - $this->attributes['author'] = $author; |
|
| 69 | - $this->attributes['categories'] = $categories; |
|
| 70 | - $this->attributes['imageUrl'] = $imageUrl; |
|
| 71 | - $this->attributes['thumbnailUrl'] = $thumbnailUrl; |
|
| 63 | + public function store(string $title, string $description, string $content, string $author, string $categories, string $imageUrl, string $thumbnailUrl): Article |
|
| 64 | + { |
|
| 65 | + $this->attributes['title'] = $title; |
|
| 66 | + $this->attributes['description'] = $description; |
|
| 67 | + $this->attributes['content'] = $content; |
|
| 68 | + $this->attributes['author'] = $author; |
|
| 69 | + $this->attributes['categories'] = $categories; |
|
| 70 | + $this->attributes['imageUrl'] = $imageUrl; |
|
| 71 | + $this->attributes['thumbnailUrl'] = $thumbnailUrl; |
|
| 72 | 72 | |
| 73 | - $this->save(); |
|
| 73 | + $this->save(); |
|
| 74 | 74 | |
| 75 | - return $this; |
|
| 76 | - } |
|
| 75 | + return $this; |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | - /** |
|
| 78 | + /** |
|
| 79 | 79 | * Get All Article Categories from the Article. |
| 80 | 80 | * |
| 81 | 81 | * @return array |
| 82 | 82 | */ |
| 83 | - public function getCategoriesAttribute(): array |
|
| 84 | - { |
|
| 85 | - $categories = []; |
|
| 83 | + public function getCategoriesAttribute(): array |
|
| 84 | + { |
|
| 85 | + $categories = []; |
|
| 86 | 86 | |
| 87 | - foreach (explode(',', $this->attributes['categories']) as $articleCategory) { |
|
| 88 | - $categories[] = ArticleCategory::query()->where('link', $articleCategory)->first(); |
|
| 89 | - } |
|
| 87 | + foreach (explode(',', $this->attributes['categories']) as $articleCategory) { |
|
| 88 | + $categories[] = ArticleCategory::query()->where('link', $articleCategory)->first(); |
|
| 89 | + } |
|
| 90 | 90 | |
| 91 | - return $categories; |
|
| 92 | - } |
|
| 91 | + return $categories; |
|
| 92 | + } |
|
| 93 | 93 | } |
@@ -1,62 +1,62 @@ discard block |
||
| 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 ShopItem. |
| 10 | 10 | * |
| 11 | 11 | * @property mixed uniqueId |
| 12 | 12 | */ |
| 13 | -class ShopItem extends ChocolateyModel |
|
| 14 | -{ |
|
| 15 | - use Eloquence, Mappable; |
|
| 13 | + class ShopItem extends ChocolateyModel |
|
| 14 | + { |
|
| 15 | + use Eloquence, Mappable; |
|
| 16 | 16 | |
| 17 | - /** |
|
| 17 | + /** |
|
| 18 | 18 | * Disable Timestamps. |
| 19 | 19 | * |
| 20 | 20 | * @var bool |
| 21 | 21 | */ |
| 22 | - public $timestamps = false; |
|
| 22 | + public $timestamps = false; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 24 | + /** |
|
| 25 | 25 | * The table associated with the model. |
| 26 | 26 | * |
| 27 | 27 | * @var string |
| 28 | 28 | */ |
| 29 | - protected $table = 'chocolatey_shop_items'; |
|
| 29 | + protected $table = 'chocolatey_shop_items'; |
|
| 30 | 30 | |
| 31 | - /** |
|
| 31 | + /** |
|
| 32 | 32 | * Primary Key of the Table. |
| 33 | 33 | * |
| 34 | 34 | * @var string |
| 35 | 35 | */ |
| 36 | - protected $primaryKey = 'id'; |
|
| 36 | + protected $primaryKey = 'id'; |
|
| 37 | 37 | |
| 38 | - /** |
|
| 38 | + /** |
|
| 39 | 39 | * The Appender(s) of the Model. |
| 40 | 40 | * |
| 41 | 41 | * @var array |
| 42 | 42 | */ |
| 43 | - protected $appends = ['paymentMethods', 'uniqueId']; |
|
| 43 | + protected $appends = ['paymentMethods', 'uniqueId']; |
|
| 44 | 44 | |
| 45 | - /** |
|
| 45 | + /** |
|
| 46 | 46 | * The attributes that will be mapped. |
| 47 | 47 | * |
| 48 | 48 | * @var array |
| 49 | 49 | */ |
| 50 | - protected $maps = ['paymentMethods' => 'payment_methods', 'uniqueId' => 'id']; |
|
| 50 | + protected $maps = ['paymentMethods' => 'payment_methods', 'uniqueId' => 'id']; |
|
| 51 | 51 | |
| 52 | - /** |
|
| 52 | + /** |
|
| 53 | 53 | * The attributes excluded from the model's JSON form. |
| 54 | 54 | * |
| 55 | 55 | * @var array |
| 56 | 56 | */ |
| 57 | - protected $hidden = ['payment_methods']; |
|
| 57 | + protected $hidden = ['payment_methods']; |
|
| 58 | 58 | |
| 59 | - /** |
|
| 59 | + /** |
|
| 60 | 60 | * Store an Shop Country. |
| 61 | 61 | * |
| 62 | 62 | * @param string $itemName |
@@ -67,55 +67,55 @@ discard block |
||
| 67 | 67 | * |
| 68 | 68 | * @return ShopItem |
| 69 | 69 | */ |
| 70 | - public function store(string $itemName, string $countryCode, int $creditAmount, int $iconId, array $paymentMethods): ShopItem |
|
| 71 | - { |
|
| 72 | - $this->attributes['name'] = $itemName; |
|
| 73 | - $this->attributes['countryCode'] = $countryCode; |
|
| 74 | - $this->attributes['creditAmount'] = $creditAmount; |
|
| 75 | - $this->attributes['iconId'] = $iconId; |
|
| 76 | - $this->attributes['payment_methods'] = implode(',', $paymentMethods); |
|
| 77 | - $this->timestamps = false; |
|
| 70 | + public function store(string $itemName, string $countryCode, int $creditAmount, int $iconId, array $paymentMethods): ShopItem |
|
| 71 | + { |
|
| 72 | + $this->attributes['name'] = $itemName; |
|
| 73 | + $this->attributes['countryCode'] = $countryCode; |
|
| 74 | + $this->attributes['creditAmount'] = $creditAmount; |
|
| 75 | + $this->attributes['iconId'] = $iconId; |
|
| 76 | + $this->attributes['payment_methods'] = implode(',', $paymentMethods); |
|
| 77 | + $this->timestamps = false; |
|
| 78 | 78 | |
| 79 | - $this->save(); |
|
| 79 | + $this->save(); |
|
| 80 | 80 | |
| 81 | - return $this; |
|
| 82 | - } |
|
| 81 | + return $this; |
|
| 82 | + } |
|
| 83 | 83 | |
| 84 | - /** |
|
| 84 | + /** |
|
| 85 | 85 | * Get Payment Methods. |
| 86 | 86 | * |
| 87 | 87 | * @return array |
| 88 | 88 | */ |
| 89 | - public function getPaymentMethodsAttribute(): array |
|
| 90 | - { |
|
| 91 | - $paymentMethods = []; |
|
| 89 | + public function getPaymentMethodsAttribute(): array |
|
| 90 | + { |
|
| 91 | + $paymentMethods = []; |
|
| 92 | 92 | |
| 93 | - if (!array_key_exists('payment_methods', $this->attributes)) { |
|
| 94 | - return $paymentMethods; |
|
| 95 | - } |
|
| 93 | + if (!array_key_exists('payment_methods', $this->attributes)) { |
|
| 94 | + return $paymentMethods; |
|
| 95 | + } |
|
| 96 | 96 | |
| 97 | - foreach (explode(',', $this->attributes['payment_methods']) as $shopCategory) { |
|
| 98 | - $paymentMethod = PaymentMethod::where('localizationKey', $shopCategory)->first(); |
|
| 99 | - $paymentMethod->setPurchaseParams([Country::where('countryCode', $this->attributes['countryCode'])->first()->uniqueId, $this->attributes['id']]); |
|
| 100 | - $paymentMethods[] = $paymentMethod; |
|
| 101 | - } |
|
| 97 | + foreach (explode(',', $this->attributes['payment_methods']) as $shopCategory) { |
|
| 98 | + $paymentMethod = PaymentMethod::where('localizationKey', $shopCategory)->first(); |
|
| 99 | + $paymentMethod->setPurchaseParams([Country::where('countryCode', $this->attributes['countryCode'])->first()->uniqueId, $this->attributes['id']]); |
|
| 100 | + $paymentMethods[] = $paymentMethod; |
|
| 101 | + } |
|
| 102 | 102 | |
| 103 | - return $paymentMethods; |
|
| 104 | - } |
|
| 103 | + return $paymentMethods; |
|
| 104 | + } |
|
| 105 | 105 | |
| 106 | - /** |
|
| 106 | + /** |
|
| 107 | 107 | * Get Shop Item Categories. |
| 108 | 108 | * |
| 109 | 109 | * @return array |
| 110 | 110 | */ |
| 111 | - public function getCategoriesAttribute(): array |
|
| 112 | - { |
|
| 113 | - $shopCategories = []; |
|
| 111 | + public function getCategoriesAttribute(): array |
|
| 112 | + { |
|
| 113 | + $shopCategories = []; |
|
| 114 | 114 | |
| 115 | - foreach (explode(',', $this->attributes['categories']) as $shopCategory) { |
|
| 116 | - $shopCategories[] = ShopCategory::find($shopCategory)->category; |
|
| 117 | - } |
|
| 115 | + foreach (explode(',', $this->attributes['categories']) as $shopCategory) { |
|
| 116 | + $shopCategories[] = ShopCategory::find($shopCategory)->category; |
|
| 117 | + } |
|
| 118 | 118 | |
| 119 | - return $shopCategories; |
|
| 120 | - } |
|
| 119 | + return $shopCategories; |
|
| 120 | + } |
|
| 121 | 121 | } |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -namespace App\Models; |
|
| 3 | + namespace App\Models; |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Class Country. |
@@ -8,37 +8,37 @@ discard block |
||
| 8 | 8 | * @property mixed countryCode |
| 9 | 9 | * @property mixed uniqueId |
| 10 | 10 | */ |
| 11 | -class Country extends ChocolateyModel |
|
| 12 | -{ |
|
| 13 | - /** |
|
| 11 | + class Country extends ChocolateyModel |
|
| 12 | + { |
|
| 13 | + /** |
|
| 14 | 14 | * Disable Timestamps. |
| 15 | 15 | * |
| 16 | 16 | * @var bool |
| 17 | 17 | */ |
| 18 | - public $timestamps = false; |
|
| 18 | + public $timestamps = false; |
|
| 19 | 19 | |
| 20 | - /** |
|
| 20 | + /** |
|
| 21 | 21 | * The table associated with the model. |
| 22 | 22 | * |
| 23 | 23 | * @var string |
| 24 | 24 | */ |
| 25 | - protected $table = 'chocolatey_shop_countries'; |
|
| 25 | + protected $table = 'chocolatey_shop_countries'; |
|
| 26 | 26 | |
| 27 | - /** |
|
| 27 | + /** |
|
| 28 | 28 | * The Appender(s) of the Model. |
| 29 | 29 | * |
| 30 | 30 | * @var array |
| 31 | 31 | */ |
| 32 | - protected $appends = ['uniqueId']; |
|
| 32 | + protected $appends = ['uniqueId']; |
|
| 33 | 33 | |
| 34 | - /** |
|
| 34 | + /** |
|
| 35 | 35 | * Primary Key of the Table. |
| 36 | 36 | * |
| 37 | 37 | * @var string |
| 38 | 38 | */ |
| 39 | - protected $primaryKey = 'id'; |
|
| 39 | + protected $primaryKey = 'id'; |
|
| 40 | 40 | |
| 41 | - /** |
|
| 41 | + /** |
|
| 42 | 42 | * Store an Shop Country. |
| 43 | 43 | * |
| 44 | 44 | * @param string $countryCode |
@@ -46,22 +46,22 @@ discard block |
||
| 46 | 46 | * |
| 47 | 47 | * @return Country |
| 48 | 48 | */ |
| 49 | - public function store(string $countryCode, string $name): Country |
|
| 50 | - { |
|
| 51 | - $this->attributes['countryCode'] = $countryCode; |
|
| 52 | - $this->attributes['name'] = $name; |
|
| 53 | - $this->timestamps = false; |
|
| 49 | + public function store(string $countryCode, string $name): Country |
|
| 50 | + { |
|
| 51 | + $this->attributes['countryCode'] = $countryCode; |
|
| 52 | + $this->attributes['name'] = $name; |
|
| 53 | + $this->timestamps = false; |
|
| 54 | 54 | |
| 55 | - return $this; |
|
| 56 | - } |
|
| 55 | + return $this; |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - /** |
|
| 58 | + /** |
|
| 59 | 59 | * Get Unique Id. |
| 60 | 60 | * |
| 61 | 61 | * @return int |
| 62 | 62 | */ |
| 63 | - public function getUniqueIdAttribute(): int |
|
| 64 | - { |
|
| 65 | - return $this->attributes['id']; |
|
| 66 | - } |
|
| 63 | + public function getUniqueIdAttribute(): int |
|
| 64 | + { |
|
| 65 | + return $this->attributes['id']; |
|
| 66 | + } |
|
| 67 | 67 | } |
@@ -1,9 +1,9 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -namespace App\Models; |
|
| 3 | + namespace App\Models; |
|
| 4 | 4 | |
| 5 | -use Illuminate\Database\Eloquent\Collection; |
|
| 6 | -use Illuminate\Support\Facades\Config; |
|
| 5 | + use Illuminate\Database\Eloquent\Collection; |
|
| 6 | + use Illuminate\Support\Facades\Config; |
|
| 7 | 7 | |
| 8 | 8 | /** |
| 9 | 9 | * Class ChocolateyId. |
@@ -11,44 +11,44 @@ discard block |
||
| 11 | 11 | * @property bool mail_verified |
| 12 | 12 | * @property int last_logged_id |
| 13 | 13 | */ |
| 14 | -class ChocolateyId extends ChocolateyModel |
|
| 15 | -{ |
|
| 16 | - /** |
|
| 14 | + class ChocolateyId extends ChocolateyModel |
|
| 15 | + { |
|
| 16 | + /** |
|
| 17 | 17 | * Disable Timestamps. |
| 18 | 18 | * |
| 19 | 19 | * @var bool |
| 20 | 20 | */ |
| 21 | - public $timestamps = false; |
|
| 21 | + public $timestamps = false; |
|
| 22 | 22 | |
| 23 | - /** |
|
| 23 | + /** |
|
| 24 | 24 | * The table associated with the model. |
| 25 | 25 | * |
| 26 | 26 | * @var string |
| 27 | 27 | */ |
| 28 | - protected $table = 'chocolatey_users_id'; |
|
| 28 | + protected $table = 'chocolatey_users_id'; |
|
| 29 | 29 | |
| 30 | - /** |
|
| 30 | + /** |
|
| 31 | 31 | * Primary Key of the Table. |
| 32 | 32 | * |
| 33 | 33 | * @var string |
| 34 | 34 | */ |
| 35 | - protected $primaryKey = 'mail'; |
|
| 35 | + protected $primaryKey = 'mail'; |
|
| 36 | 36 | |
| 37 | - /** |
|
| 37 | + /** |
|
| 38 | 38 | * The Appender(s) of the Model. |
| 39 | 39 | * |
| 40 | 40 | * @var array |
| 41 | 41 | */ |
| 42 | - protected $appends = ['relatedAccounts']; |
|
| 42 | + protected $appends = ['relatedAccounts']; |
|
| 43 | 43 | |
| 44 | - /** |
|
| 44 | + /** |
|
| 45 | 45 | * The attributes that are mass assignable. |
| 46 | 46 | * |
| 47 | 47 | * @var array |
| 48 | 48 | */ |
| 49 | - protected $fillable = ['mail', 'password', 'last_logged_id', 'mail_verified']; |
|
| 49 | + protected $fillable = ['mail', 'password', 'last_logged_id', 'mail_verified']; |
|
| 50 | 50 | |
| 51 | - /** |
|
| 51 | + /** |
|
| 52 | 52 | * Store a new Azure Id Account. |
| 53 | 53 | * |
| 54 | 54 | * @param string $userMail |
@@ -56,24 +56,24 @@ discard block |
||
| 56 | 56 | * |
| 57 | 57 | * @return ChocolateyId |
| 58 | 58 | */ |
| 59 | - public function store(string $userMail, string $userPassword): ChocolateyId |
|
| 60 | - { |
|
| 61 | - $this->attributes['password'] = hash(Config::get('chocolatey.security.hash'), $userPassword); |
|
| 62 | - $this->attributes['mail'] = $userMail; |
|
| 63 | - $this->timestamps = false; |
|
| 59 | + public function store(string $userMail, string $userPassword): ChocolateyId |
|
| 60 | + { |
|
| 61 | + $this->attributes['password'] = hash(Config::get('chocolatey.security.hash'), $userPassword); |
|
| 62 | + $this->attributes['mail'] = $userMail; |
|
| 63 | + $this->timestamps = false; |
|
| 64 | 64 | |
| 65 | - $this->save(); |
|
| 65 | + $this->save(); |
|
| 66 | 66 | |
| 67 | - return $this; |
|
| 68 | - } |
|
| 67 | + return $this; |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | - /** |
|
| 70 | + /** |
|
| 71 | 71 | * Get All Accounts related with this E-mail. |
| 72 | 72 | * |
| 73 | 73 | * @return Collection|static[] |
| 74 | 74 | */ |
| 75 | - public function getRelatedAccountsAttribute() |
|
| 76 | - { |
|
| 77 | - return User::where('mail', $this->attributes['mail'])->get(); |
|
| 78 | - } |
|
| 75 | + public function getRelatedAccountsAttribute() |
|
| 76 | + { |
|
| 77 | + return User::where('mail', $this->attributes['mail'])->get(); |
|
| 78 | + } |
|
| 79 | 79 | } |
@@ -1,64 +1,64 @@ |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -namespace App\Models; |
|
| 3 | + namespace App\Models; |
|
| 4 | 4 | |
| 5 | -use Illuminate\Database\Eloquent\Model; |
|
| 5 | + use Illuminate\Database\Eloquent\Model; |
|
| 6 | 6 | |
| 7 | 7 | /** |
| 8 | 8 | * Class UserPreferences. |
| 9 | 9 | */ |
| 10 | -class UserPreferences extends Model |
|
| 11 | -{ |
|
| 12 | - /** |
|
| 10 | + class UserPreferences extends Model |
|
| 11 | + { |
|
| 12 | + /** |
|
| 13 | 13 | * Disable Timestamps. |
| 14 | 14 | * |
| 15 | 15 | * @var bool |
| 16 | 16 | */ |
| 17 | - public $timestamps = false; |
|
| 17 | + public $timestamps = false; |
|
| 18 | 18 | |
| 19 | - /** |
|
| 19 | + /** |
|
| 20 | 20 | * The table associated with the model. |
| 21 | 21 | * |
| 22 | 22 | * @var string |
| 23 | 23 | */ |
| 24 | - protected $table = 'chocolatey_users_preferences'; |
|
| 24 | + protected $table = 'chocolatey_users_preferences'; |
|
| 25 | 25 | |
| 26 | - /** |
|
| 26 | + /** |
|
| 27 | 27 | * Primary Key of the Table. |
| 28 | 28 | * |
| 29 | 29 | * @var string |
| 30 | 30 | */ |
| 31 | - protected $primaryKey = 'user_id'; |
|
| 31 | + protected $primaryKey = 'user_id'; |
|
| 32 | 32 | |
| 33 | - /** |
|
| 33 | + /** |
|
| 34 | 34 | * The attributes excluded from the model's JSON form. |
| 35 | 35 | * |
| 36 | 36 | * @var array |
| 37 | 37 | */ |
| 38 | - protected $hidden = ['user_id']; |
|
| 38 | + protected $hidden = ['user_id']; |
|
| 39 | 39 | |
| 40 | - /** |
|
| 40 | + /** |
|
| 41 | 41 | * The attributes that are mass assignable. |
| 42 | 42 | * |
| 43 | 43 | * @var array |
| 44 | 44 | */ |
| 45 | - protected $fillable = ['emailFriendRequestNotificationEnabled', 'emailGiftNotificationEnabled', 'emailGroupNotificationEnabled', 'emailMiniMailNotificationEnabled', |
|
| 46 | - 'emailNewsletterEnabled', 'emailRoomMessageNotificationEnabled', 'friendCanFollow', 'friendRequestEnabled', 'offlineMessagingEnabled', 'onlineStatusVisible', 'profileVisible', ]; |
|
| 45 | + protected $fillable = ['emailFriendRequestNotificationEnabled', 'emailGiftNotificationEnabled', 'emailGroupNotificationEnabled', 'emailMiniMailNotificationEnabled', |
|
| 46 | + 'emailNewsletterEnabled', 'emailRoomMessageNotificationEnabled', 'friendCanFollow', 'friendRequestEnabled', 'offlineMessagingEnabled', 'onlineStatusVisible', 'profileVisible', ]; |
|
| 47 | 47 | |
| 48 | - /** |
|
| 48 | + /** |
|
| 49 | 49 | * Store an User Preference set on the Database. |
| 50 | 50 | * |
| 51 | 51 | * @param int $userId |
| 52 | 52 | * |
| 53 | 53 | * @return UserPreferences |
| 54 | 54 | */ |
| 55 | - public function store(int $userId): UserPreferences |
|
| 56 | - { |
|
| 57 | - $this->attributes['user_id'] = $userId; |
|
| 58 | - $this->timestamps = false; |
|
| 55 | + public function store(int $userId): UserPreferences |
|
| 56 | + { |
|
| 57 | + $this->attributes['user_id'] = $userId; |
|
| 58 | + $this->timestamps = false; |
|
| 59 | 59 | |
| 60 | - $this->save(); |
|
| 60 | + $this->save(); |
|
| 61 | 61 | |
| 62 | - return $this; |
|
| 63 | - } |
|
| 62 | + return $this; |
|
| 63 | + } |
|
| 64 | 64 | } |