@@ -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 | } |
@@ -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 Mail. |
| 7 | 7 | */ |
| 8 | -class Mail extends ChocolateyModel |
|
| 9 | -{ |
|
| 10 | - /** |
|
| 8 | + class Mail extends ChocolateyModel |
|
| 9 | + { |
|
| 10 | + /** |
|
| 11 | 11 | * The table associated with the model. |
| 12 | 12 | * |
| 13 | 13 | * @var string |
| 14 | 14 | */ |
| 15 | - protected $table = 'chocolatey_users_mail_requests'; |
|
| 15 | + protected $table = 'chocolatey_users_mail_requests'; |
|
| 16 | 16 | |
| 17 | - /** |
|
| 17 | + /** |
|
| 18 | 18 | * Primary Key of the Table. |
| 19 | 19 | * |
| 20 | 20 | * @var string |
| 21 | 21 | */ |
| 22 | - protected $primaryKey = 'id'; |
|
| 22 | + protected $primaryKey = 'id'; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 24 | + /** |
|
| 25 | 25 | * The attributes that are mass assignable. |
| 26 | 26 | * |
| 27 | 27 | * @var array |
| 28 | 28 | */ |
| 29 | - protected $fillable = ['used']; |
|
| 29 | + protected $fillable = ['used']; |
|
| 30 | 30 | |
| 31 | - /** |
|
| 31 | + /** |
|
| 32 | 32 | * Store a Mail Request. |
| 33 | 33 | * |
| 34 | 34 | * @param string $token |
@@ -37,14 +37,14 @@ discard block |
||
| 37 | 37 | * |
| 38 | 38 | * @return Mail |
| 39 | 39 | */ |
| 40 | - public function store(string $token, string $link, string $userMail): Mail |
|
| 41 | - { |
|
| 42 | - $this->attributes['token'] = $token; |
|
| 43 | - $this->attributes['link'] = $link; |
|
| 44 | - $this->attributes['mail'] = $userMail; |
|
| 40 | + public function store(string $token, string $link, string $userMail): Mail |
|
| 41 | + { |
|
| 42 | + $this->attributes['token'] = $token; |
|
| 43 | + $this->attributes['link'] = $link; |
|
| 44 | + $this->attributes['mail'] = $userMail; |
|
| 45 | 45 | |
| 46 | - $this->save(); |
|
| 46 | + $this->save(); |
|
| 47 | 47 | |
| 48 | - return $this; |
|
| 49 | - } |
|
| 48 | + return $this; |
|
| 49 | + } |
|
| 50 | 50 | } |
@@ -1,53 +1,53 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -namespace App\Models; |
|
| 3 | + namespace App\Models; |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Class ArticleCategory. |
| 7 | 7 | * |
| 8 | 8 | * @property string name |
| 9 | 9 | */ |
| 10 | -class ArticleCategory extends ChocolateyModel |
|
| 11 | -{ |
|
| 12 | - /** |
|
| 10 | + class ArticleCategory extends ChocolateyModel |
|
| 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 | * Appenders Array. |
| 21 | 21 | * |
| 22 | 22 | * @var array |
| 23 | 23 | */ |
| 24 | - protected $appends = ['name']; |
|
| 24 | + protected $appends = ['name']; |
|
| 25 | 25 | |
| 26 | - /** |
|
| 26 | + /** |
|
| 27 | 27 | * The table associated with the model. |
| 28 | 28 | * |
| 29 | 29 | * @var string |
| 30 | 30 | */ |
| 31 | - protected $table = 'chocolatey_articles_categories'; |
|
| 31 | + protected $table = 'chocolatey_articles_categories'; |
|
| 32 | 32 | |
| 33 | - /** |
|
| 33 | + /** |
|
| 34 | 34 | * Primary Key of the Table. |
| 35 | 35 | * |
| 36 | 36 | * @var string |
| 37 | 37 | */ |
| 38 | - protected $primaryKey = 'link'; |
|
| 38 | + protected $primaryKey = 'link'; |
|
| 39 | 39 | |
| 40 | - /** |
|
| 40 | + /** |
|
| 41 | 41 | * Get the Original Link Attribute. |
| 42 | 42 | * |
| 43 | 43 | * @return string |
| 44 | 44 | */ |
| 45 | - public function getNameAttribute() |
|
| 46 | - { |
|
| 47 | - return $this->attributes['link']; |
|
| 48 | - } |
|
| 45 | + public function getNameAttribute() |
|
| 46 | + { |
|
| 47 | + return $this->attributes['link']; |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - /** |
|
| 50 | + /** |
|
| 51 | 51 | * Store a New Article Category. |
| 52 | 52 | * |
| 53 | 53 | * @param string $link |
@@ -55,14 +55,14 @@ discard block |
||
| 55 | 55 | * |
| 56 | 56 | * @return $this |
| 57 | 57 | */ |
| 58 | - public function store(string $link, string $translate) |
|
| 59 | - { |
|
| 60 | - $this->attributes['link'] = $link; |
|
| 61 | - $this->attributes['translate'] = $translate; |
|
| 62 | - $this->timestamps = false; |
|
| 58 | + public function store(string $link, string $translate) |
|
| 59 | + { |
|
| 60 | + $this->attributes['link'] = $link; |
|
| 61 | + $this->attributes['translate'] = $translate; |
|
| 62 | + $this->timestamps = false; |
|
| 63 | 63 | |
| 64 | - $this->save(); |
|
| 64 | + $this->save(); |
|
| 65 | 65 | |
| 66 | - return $this; |
|
| 67 | - } |
|
| 66 | + return $this; |
|
| 67 | + } |
|
| 68 | 68 | } |
@@ -1,67 +1,67 @@ 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 PaymentMethod. |
| 10 | 10 | */ |
| 11 | -class PaymentMethod extends ChocolateyModel |
|
| 12 | -{ |
|
| 13 | - use Eloquence, Mappable; |
|
| 11 | + class PaymentMethod 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 | * Purchase Params. |
| 24 | 24 | * |
| 25 | 25 | * @var PurchaseParam |
| 26 | 26 | */ |
| 27 | - public $purchaseParams = null; |
|
| 27 | + public $purchaseParams = null; |
|
| 28 | 28 | |
| 29 | - /** |
|
| 29 | + /** |
|
| 30 | 30 | * The table associated with the model. |
| 31 | 31 | * |
| 32 | 32 | * @var string |
| 33 | 33 | */ |
| 34 | - protected $table = 'chocolatey_shop_payment_methods'; |
|
| 34 | + protected $table = 'chocolatey_shop_payment_methods'; |
|
| 35 | 35 | |
| 36 | - /** |
|
| 36 | + /** |
|
| 37 | 37 | * Primary Key of the Table. |
| 38 | 38 | * |
| 39 | 39 | * @var string |
| 40 | 40 | */ |
| 41 | - protected $primaryKey = 'id'; |
|
| 41 | + protected $primaryKey = 'id'; |
|
| 42 | 42 | |
| 43 | - /** |
|
| 43 | + /** |
|
| 44 | 44 | * The Appender(s) of the Model. |
| 45 | 45 | * |
| 46 | 46 | * @var array |
| 47 | 47 | */ |
| 48 | - protected $appends = ['disclaimerRequired', 'premiumSms', 'purchaseParams', 'requestPath']; |
|
| 48 | + protected $appends = ['disclaimerRequired', 'premiumSms', 'purchaseParams', 'requestPath']; |
|
| 49 | 49 | |
| 50 | - /** |
|
| 50 | + /** |
|
| 51 | 51 | * The attributes excluded from the model's JSON form. |
| 52 | 52 | * |
| 53 | 53 | * @var array |
| 54 | 54 | */ |
| 55 | - protected $hidden = ['disclaimer']; |
|
| 55 | + protected $hidden = ['disclaimer']; |
|
| 56 | 56 | |
| 57 | - /** |
|
| 57 | + /** |
|
| 58 | 58 | * The attributes that will be mapped. |
| 59 | 59 | * |
| 60 | 60 | * @var array |
| 61 | 61 | */ |
| 62 | - protected $maps = ['disclaimerRequired' => 'disclaimer']; |
|
| 62 | + protected $maps = ['disclaimerRequired' => 'disclaimer']; |
|
| 63 | 63 | |
| 64 | - /** |
|
| 64 | + /** |
|
| 65 | 65 | * Store an Shop Country. |
| 66 | 66 | * |
| 67 | 67 | * @param string $methodName |
@@ -71,76 +71,76 @@ discard block |
||
| 71 | 71 | * |
| 72 | 72 | * @return PaymentMethod |
| 73 | 73 | */ |
| 74 | - public function store(string $methodName, string $code, string $buttonImageUrl, string $buttonText): PaymentMethod |
|
| 75 | - { |
|
| 76 | - $this->attributes['name'] = $methodName; |
|
| 77 | - $this->attributes['buttonLogoUrl'] = $buttonImageUrl; |
|
| 78 | - $this->attributes['buttonText'] = $buttonText; |
|
| 79 | - $this->attributes['localizationKey'] = $code; |
|
| 80 | - $this->timestamps = false; |
|
| 74 | + public function store(string $methodName, string $code, string $buttonImageUrl, string $buttonText): PaymentMethod |
|
| 75 | + { |
|
| 76 | + $this->attributes['name'] = $methodName; |
|
| 77 | + $this->attributes['buttonLogoUrl'] = $buttonImageUrl; |
|
| 78 | + $this->attributes['buttonText'] = $buttonText; |
|
| 79 | + $this->attributes['localizationKey'] = $code; |
|
| 80 | + $this->timestamps = false; |
|
| 81 | 81 | |
| 82 | - $this->save(); |
|
| 82 | + $this->save(); |
|
| 83 | 83 | |
| 84 | - return $this; |
|
| 85 | - } |
|
| 84 | + return $this; |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | - /** |
|
| 87 | + /** |
|
| 88 | 88 | * Get Disclaimer Required Attribute. |
| 89 | 89 | * |
| 90 | 90 | * @return bool |
| 91 | 91 | */ |
| 92 | - public function getDisclaimerRequiredAttribute(): bool |
|
| 93 | - { |
|
| 94 | - return $this->attributes['disclaimer'] == 1; |
|
| 95 | - } |
|
| 92 | + public function getDisclaimerRequiredAttribute(): bool |
|
| 93 | + { |
|
| 94 | + return $this->attributes['disclaimer'] == 1; |
|
| 95 | + } |
|
| 96 | 96 | |
| 97 | - /** |
|
| 97 | + /** |
|
| 98 | 98 | * Get Premium SMS Attribute. |
| 99 | 99 | * |
| 100 | 100 | * @return bool |
| 101 | 101 | */ |
| 102 | - public function getPremiumSmsAttribute(): bool |
|
| 103 | - { |
|
| 104 | - return false; |
|
| 105 | - } |
|
| 102 | + public function getPremiumSmsAttribute(): bool |
|
| 103 | + { |
|
| 104 | + return false; |
|
| 105 | + } |
|
| 106 | 106 | |
| 107 | - /** |
|
| 107 | + /** |
|
| 108 | 108 | * Get Request Path Attribute. |
| 109 | 109 | * |
| 110 | 110 | * @return string |
| 111 | 111 | */ |
| 112 | - public function getRequestPathAttribute(): string |
|
| 113 | - { |
|
| 114 | - return 'online'; |
|
| 115 | - } |
|
| 112 | + public function getRequestPathAttribute(): string |
|
| 113 | + { |
|
| 114 | + return 'online'; |
|
| 115 | + } |
|
| 116 | 116 | |
| 117 | - /** |
|
| 117 | + /** |
|
| 118 | 118 | * Get the Purchase Params. |
| 119 | 119 | * |
| 120 | 120 | * @return PurchaseParam |
| 121 | 121 | */ |
| 122 | - public function getPurchaseParamsAttribute(): PurchaseParam |
|
| 123 | - { |
|
| 124 | - return $this->purchaseParams; |
|
| 125 | - } |
|
| 122 | + public function getPurchaseParamsAttribute(): PurchaseParam |
|
| 123 | + { |
|
| 124 | + return $this->purchaseParams; |
|
| 125 | + } |
|
| 126 | 126 | |
| 127 | - /** |
|
| 127 | + /** |
|
| 128 | 128 | * Set Purchase Params. |
| 129 | 129 | * |
| 130 | 130 | * @param array $parameters |
| 131 | 131 | */ |
| 132 | - public function setPurchaseParams(array $parameters) |
|
| 133 | - { |
|
| 134 | - $this->purchaseParams = new PurchaseParam($parameters[0], $parameters[1], $this->attributes['id']); |
|
| 135 | - } |
|
| 132 | + public function setPurchaseParams(array $parameters) |
|
| 133 | + { |
|
| 134 | + $this->purchaseParams = new PurchaseParam($parameters[0], $parameters[1], $this->attributes['id']); |
|
| 135 | + } |
|
| 136 | 136 | |
| 137 | - /** |
|
| 137 | + /** |
|
| 138 | 138 | * Get Category Payment Type. |
| 139 | 139 | * |
| 140 | 140 | * @return string |
| 141 | 141 | */ |
| 142 | - public function getCategoryAttribute(): string |
|
| 143 | - { |
|
| 144 | - return PaymentCategory::find($this->attributes['category'])->payment_type; |
|
| 145 | - } |
|
| 142 | + public function getCategoryAttribute(): string |
|
| 143 | + { |
|
| 144 | + return PaymentCategory::find($this->attributes['category'])->payment_type; |
|
| 145 | + } |
|
| 146 | 146 | } |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | return; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - Mail::send($view, $configuration, function ($message) use ($configuration) { |
|
| 27 | + Mail::send($view, $configuration, function($message) use ($configuration) { |
|
| 28 | 28 | $message->from(Config::get('mail.from.address'), Config::get('mail.from.name')); |
| 29 | 29 | $message->to($configuration['email'])->subject($configuration['subject']); |
| 30 | 30 | }); |
@@ -1,36 +1,36 @@ discard block |
||
| 1 | -<?php |
|
| 1 | + <?php |
|
| 2 | 2 | |
| 3 | -namespace App\Http\Controllers; |
|
| 3 | + namespace App\Http\Controllers; |
|
| 4 | 4 | |
| 5 | -use App\Models\Mail as MailModel; |
|
| 6 | -use Illuminate\Support\Facades\Config; |
|
| 7 | -use Illuminate\Support\Facades\Mail; |
|
| 8 | -use Laravel\Lumen\Routing\Controller as BaseController; |
|
| 5 | + use App\Models\Mail as MailModel; |
|
| 6 | + use Illuminate\Support\Facades\Config; |
|
| 7 | + use Illuminate\Support\Facades\Mail; |
|
| 8 | + use Laravel\Lumen\Routing\Controller as BaseController; |
|
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * Class MailController. |
| 12 | 12 | */ |
| 13 | -class MailController extends BaseController |
|
| 14 | -{ |
|
| 15 | - /** |
|
| 13 | + class MailController extends BaseController |
|
| 14 | + { |
|
| 15 | + /** |
|
| 16 | 16 | * Send an Email. |
| 17 | 17 | * |
| 18 | 18 | * @param array $configuration |
| 19 | 19 | * @param string $view |
| 20 | 20 | */ |
| 21 | - public function send(array $configuration, string $view = 'habbo-web-mail.confirm-mail') |
|
| 22 | - { |
|
| 23 | - if (!Config::get('mail.enable')) { |
|
| 24 | - return; |
|
| 25 | - } |
|
| 21 | + public function send(array $configuration, string $view = 'habbo-web-mail.confirm-mail') |
|
| 22 | + { |
|
| 23 | + if (!Config::get('mail.enable')) { |
|
| 24 | + return; |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - Mail::send($view, $configuration, function ($message) use ($configuration) { |
|
| 28 | - $message->from(Config::get('mail.from.address'), Config::get('mail.from.name')); |
|
| 29 | - $message->to($configuration['email'])->subject($configuration['subject']); |
|
| 30 | - }); |
|
| 31 | - } |
|
| 27 | + Mail::send($view, $configuration, function ($message) use ($configuration) { |
|
| 28 | + $message->from(Config::get('mail.from.address'), Config::get('mail.from.name')); |
|
| 29 | + $message->to($configuration['email'])->subject($configuration['subject']); |
|
| 30 | + }); |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - /** |
|
| 33 | + /** |
|
| 34 | 34 | * Prepare the E-Mail. |
| 35 | 35 | * |
| 36 | 36 | * @param string $email |
@@ -38,28 +38,28 @@ discard block |
||
| 38 | 38 | * |
| 39 | 39 | * @return string |
| 40 | 40 | */ |
| 41 | - public function prepare(string $email, string $url): string |
|
| 42 | - { |
|
| 43 | - (new MailModel())->store($token = uniqid('HabboMail', true), $url, $email)->save(); |
|
| 41 | + public function prepare(string $email, string $url): string |
|
| 42 | + { |
|
| 43 | + (new MailModel())->store($token = uniqid('HabboMail', true), $url, $email)->save(); |
|
| 44 | 44 | |
| 45 | - return $token; |
|
| 46 | - } |
|
| 45 | + return $token; |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - /** |
|
| 48 | + /** |
|
| 49 | 49 | * Get E-Mail by Controller. |
| 50 | 50 | * |
| 51 | 51 | * @param string $token |
| 52 | 52 | * |
| 53 | 53 | * @return object |
| 54 | 54 | */ |
| 55 | - public function getMail(string $token) |
|
| 56 | - { |
|
| 57 | - $mailRequest = MailModel::where('token', $token)->where('used', '0')->first(); |
|
| 55 | + public function getMail(string $token) |
|
| 56 | + { |
|
| 57 | + $mailRequest = MailModel::where('token', $token)->where('used', '0')->first(); |
|
| 58 | 58 | |
| 59 | - if ($mailRequest !== null) { |
|
| 60 | - $mailRequest->update(['used' => '1']); |
|
| 61 | - } |
|
| 59 | + if ($mailRequest !== null) { |
|
| 60 | + $mailRequest->update(['used' => '1']); |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - return $mailRequest; |
|
| 64 | - } |
|
| 63 | + return $mailRequest; |
|
| 64 | + } |
|
| 65 | 65 | } |
@@ -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 Permissions. |
| 7 | 7 | */ |
| 8 | -class Permissions extends ChocolateyModel |
|
| 9 | -{ |
|
| 10 | - /** |
|
| 8 | + class Permissions 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 = 'permissions'; |
|
| 22 | + protected $table = 'permissions'; |
|
| 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,68 +1,68 @@ 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\ChocolateyId; |
|
| 7 | -use App\Models\User; |
|
| 8 | -use Facebook\Facebook; |
|
| 9 | -use Facebook\GraphNodes\GraphUser; |
|
| 10 | -use Illuminate\Http\JsonResponse; |
|
| 11 | -use Illuminate\Http\Request; |
|
| 12 | -use Illuminate\Support\Facades\Config; |
|
| 13 | -use Laravel\Lumen\Routing\Controller as BaseController; |
|
| 5 | + use App\Facades\User as UserFacade; |
|
| 6 | + use App\Models\ChocolateyId; |
|
| 7 | + use App\Models\User; |
|
| 8 | + use Facebook\Facebook; |
|
| 9 | + use Facebook\GraphNodes\GraphUser; |
|
| 10 | + use Illuminate\Http\JsonResponse; |
|
| 11 | + use Illuminate\Http\Request; |
|
| 12 | + use Illuminate\Support\Facades\Config; |
|
| 13 | + use Laravel\Lumen\Routing\Controller as BaseController; |
|
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * Class LoginController. |
| 17 | 17 | */ |
| 18 | -class LoginController extends BaseController |
|
| 19 | -{ |
|
| 20 | - /** |
|
| 18 | + class LoginController extends BaseController |
|
| 19 | + { |
|
| 20 | + /** |
|
| 21 | 21 | * Handles the Response of the Login Attempt. |
| 22 | 22 | * |
| 23 | 23 | * @param Request $request |
| 24 | 24 | * |
| 25 | 25 | * @return JsonResponse |
| 26 | 26 | */ |
| 27 | - public function login(Request $request): JsonResponse |
|
| 28 | - { |
|
| 29 | - if (UserFacade::loginUser($request) !== null) { |
|
| 30 | - if (UserFacade::getUser()->isBanned) { |
|
| 31 | - return $this->sendBanMessage($request); |
|
| 32 | - } |
|
| 27 | + public function login(Request $request): JsonResponse |
|
| 28 | + { |
|
| 29 | + if (UserFacade::loginUser($request) !== null) { |
|
| 30 | + if (UserFacade::getUser()->isBanned) { |
|
| 31 | + return $this->sendBanMessage($request); |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - return response()->json(UserFacade::updateSession(['last_login' => time(), 'ip_current' => $request->ip()])); |
|
| 35 | - } |
|
| 34 | + return response()->json(UserFacade::updateSession(['last_login' => time(), 'ip_current' => $request->ip()])); |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - //return response()->json(['message' => 'login.staff_login_not_allowed', 'captcha' => false], 401); // Example for Non Allowance of Staffs |
|
| 38 | - return response()->json(['message' => 'login.invalid_password', 'captcha' => false], 401); |
|
| 39 | - } |
|
| 37 | + //return response()->json(['message' => 'login.staff_login_not_allowed', 'captcha' => false], 401); // Example for Non Allowance of Staffs |
|
| 38 | + return response()->json(['message' => 'login.invalid_password', 'captcha' => false], 401); |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - /** |
|
| 41 | + /** |
|
| 42 | 42 | * Return the Ban Message. |
| 43 | 43 | * |
| 44 | 44 | * @return JsonResponse |
| 45 | 45 | */ |
| 46 | - protected function sendBanMessage(): JsonResponse |
|
| 47 | - { |
|
| 48 | - return response()->json(['message' => 'login.user_banned', |
|
| 49 | - 'expiryTime' => UserFacade::getUser()->banDetails->ban_expire, |
|
| 50 | - 'reason' => UserFacade::getUser()->banDetails->ban_reason, ], 401); |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - /** |
|
| 46 | + protected function sendBanMessage(): JsonResponse |
|
| 47 | + { |
|
| 48 | + return response()->json(['message' => 'login.user_banned', |
|
| 49 | + 'expiryTime' => UserFacade::getUser()->banDetails->ban_expire, |
|
| 50 | + 'reason' => UserFacade::getUser()->banDetails->ban_reason, ], 401); |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + /** |
|
| 54 | 54 | * Destroys the User Session. |
| 55 | 55 | * |
| 56 | 56 | * @return JsonResponse |
| 57 | 57 | */ |
| 58 | - public function logout(): JsonResponse |
|
| 59 | - { |
|
| 60 | - UserFacade::eraseSession(); |
|
| 58 | + public function logout(): JsonResponse |
|
| 59 | + { |
|
| 60 | + UserFacade::eraseSession(); |
|
| 61 | 61 | |
| 62 | - return response()->json(null); |
|
| 63 | - } |
|
| 62 | + return response()->json(null); |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - /** |
|
| 65 | + /** |
|
| 66 | 66 | * Register an User on the Database |
| 67 | 67 | * and do the Login of the User. |
| 68 | 68 | * |
@@ -70,62 +70,62 @@ discard block |
||
| 70 | 70 | * |
| 71 | 71 | * @return JsonResponse |
| 72 | 72 | */ |
| 73 | - public function register(Request $request): JsonResponse |
|
| 74 | - { |
|
| 75 | - if (ChocolateyId::where('mail', $request->json()->get('email'))->count() > 0) { |
|
| 76 | - return response()->json(['error' => 'registration_email_in_use'], 409); |
|
| 77 | - } |
|
| 73 | + public function register(Request $request): JsonResponse |
|
| 74 | + { |
|
| 75 | + if (ChocolateyId::where('mail', $request->json()->get('email'))->count() > 0) { |
|
| 76 | + return response()->json(['error' => 'registration_email_in_use'], 409); |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | - if (User::where('ip_register', $request->ip())->count() > 0) { |
|
| 80 | - return response()->json(['error' => 'registration_email_in_use'], 409); |
|
| 81 | - } |
|
| 79 | + if (User::where('ip_register', $request->ip())->count() > 0) { |
|
| 80 | + return response()->json(['error' => 'registration_email_in_use'], 409); |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - $dateOfBirth = strtotime("{$request->json()->get('birthdate')['day']}/{$request->json()->get('birthdate')['month']}/{$request->json()->get('birthdate')['year']}"); |
|
| 83 | + $dateOfBirth = strtotime("{$request->json()->get('birthdate')['day']}/{$request->json()->get('birthdate')['month']}/{$request->json()->get('birthdate')['year']}"); |
|
| 84 | 84 | |
| 85 | - (new AccountController())->createUser($request, $request->json()->all(), true); |
|
| 85 | + (new AccountController())->createUser($request, $request->json()->all(), true); |
|
| 86 | 86 | |
| 87 | - (new ChocolateyId())->store($request->json()->get('email'), $request->json()->get('password')); |
|
| 87 | + (new ChocolateyId())->store($request->json()->get('email'), $request->json()->get('password')); |
|
| 88 | 88 | |
| 89 | - UserFacade::updateSession(['last_login' => time(), 'ip_register' => $request->ip(), 'ip_current' => $request->ip(), 'account_day_of_birth' => $dateOfBirth]); |
|
| 89 | + UserFacade::updateSession(['last_login' => time(), 'ip_register' => $request->ip(), 'ip_current' => $request->ip(), 'account_day_of_birth' => $dateOfBirth]); |
|
| 90 | 90 | |
| 91 | - return response()->json(UserFacade::getUser()); |
|
| 92 | - } |
|
| 91 | + return response()->json(UserFacade::getUser()); |
|
| 92 | + } |
|
| 93 | 93 | |
| 94 | - /** |
|
| 94 | + /** |
|
| 95 | 95 | * Create or Login a Facebook User. |
| 96 | 96 | * |
| 97 | 97 | * @param Request $request |
| 98 | 98 | * |
| 99 | 99 | * @return JsonResponse |
| 100 | 100 | */ |
| 101 | - public function facebook(Request $request): JsonResponse |
|
| 102 | - { |
|
| 103 | - $fbUser = $this->fbAuth($request); |
|
| 101 | + public function facebook(Request $request): JsonResponse |
|
| 102 | + { |
|
| 103 | + $fbUser = $this->fbAuth($request); |
|
| 104 | 104 | |
| 105 | - if (User::query()->where('real_name', $fbUser->getId())->count() > 0) { |
|
| 106 | - return response()->json(UserFacade::setSession(User::where('real_name', $fbUser->getId())->first())); |
|
| 107 | - } |
|
| 105 | + if (User::query()->where('real_name', $fbUser->getId())->count() > 0) { |
|
| 106 | + return response()->json(UserFacade::setSession(User::where('real_name', $fbUser->getId())->first())); |
|
| 107 | + } |
|
| 108 | 108 | |
| 109 | - (new AccountController())->createUser($request, ['email' => $fbUser->getEmail().'-fblogin'], true, false); |
|
| 109 | + (new AccountController())->createUser($request, ['email' => $fbUser->getEmail().'-fblogin'], true, false); |
|
| 110 | 110 | |
| 111 | - UserFacade::updateSession(['last_login' => time(), 'ip_register' => $request->ip(), 'ip_current' => $request->ip(), 'real_name' => $fbUser->getId()]); |
|
| 111 | + UserFacade::updateSession(['last_login' => time(), 'ip_register' => $request->ip(), 'ip_current' => $request->ip(), 'real_name' => $fbUser->getId()]); |
|
| 112 | 112 | |
| 113 | - return response()->json(UserFacade::getUser()); |
|
| 114 | - } |
|
| 113 | + return response()->json(UserFacade::getUser()); |
|
| 114 | + } |
|
| 115 | 115 | |
| 116 | - /** |
|
| 116 | + /** |
|
| 117 | 117 | * Do Facebook Authentication. |
| 118 | 118 | * |
| 119 | 119 | * @param Request $request |
| 120 | 120 | * |
| 121 | 121 | * @return GraphUser |
| 122 | 122 | */ |
| 123 | - protected function fbAuth(Request $request): GraphUser |
|
| 124 | - { |
|
| 125 | - $facebook = new Facebook(['app_id' => Config::get('chocolatey.facebook.app.key'), 'app_secret' => Config::get('chocolatey.facebook.app.secret')]); |
|
| 123 | + protected function fbAuth(Request $request): GraphUser |
|
| 124 | + { |
|
| 125 | + $facebook = new Facebook(['app_id' => Config::get('chocolatey.facebook.app.key'), 'app_secret' => Config::get('chocolatey.facebook.app.secret')]); |
|
| 126 | 126 | |
| 127 | - $facebook->setDefaultAccessToken($request->json()->get('accessToken')); |
|
| 127 | + $facebook->setDefaultAccessToken($request->json()->get('accessToken')); |
|
| 128 | 128 | |
| 129 | - return $facebook->get('/me?fields=id,name,email')->getGraphUser(); |
|
| 130 | - } |
|
| 129 | + return $facebook->get('/me?fields=id,name,email')->getGraphUser(); |
|
| 130 | + } |
|
| 131 | 131 | } |
@@ -106,7 +106,7 @@ |
||
| 106 | 106 | return response()->json(UserFacade::setSession(User::where('real_name', $fbUser->getId())->first())); |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - (new AccountController())->createUser($request, ['email' => $fbUser->getEmail().'-fblogin'], true, false); |
|
| 109 | + (new AccountController())->createUser($request, ['email' => $fbUser->getEmail() . '-fblogin'], true, false); |
|
| 110 | 110 | |
| 111 | 111 | UserFacade::updateSession(['last_login' => time(), 'ip_register' => $request->ip(), 'ip_current' => $request->ip(), 'real_name' => $fbUser->getId()]); |
| 112 | 112 | |