Apply Laravel coding style

Shift automatically applies the Laravel coding style - which uses the PSR-12 coding style as a base with some minor additions.

You may customize the code style applied by configuring [Pint](https://laravel.com/docs/pint), [PHP CS Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer), or [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) for your project root.

For more information on customizing the code style applied by Shift, [watch this short video](https://laravelshift.com/videos/shift-code-style).
This commit is contained in:
Shift
2023-02-19 16:18:46 +00:00
committed by HolgerHatGarKeineNode
parent a15ca4a2bc
commit 5776b01d15
333 changed files with 4915 additions and 4967 deletions

View File

@@ -17,25 +17,27 @@ class BitcoinEvent extends Model implements HasMedia
/**
* The attributes that aren't mass assignable.
*
* @var array
*/
protected $guarded = [];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'id' => 'integer',
'id' => 'integer',
'venue_id' => 'integer',
'from' => 'datetime',
'to' => 'datetime',
'from' => 'datetime',
'to' => 'datetime',
];
protected static function booted()
{
static::creating(function ($model) {
if (!$model->created_by) {
if (! $model->created_by) {
$model->created_by = auth()->id();
}
});

View File

@@ -3,7 +3,6 @@
namespace App\Models;
use Akuechler\Geoly;
use App\Models\Scopes\ActiveBookCases;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
@@ -23,26 +22,28 @@ class BookCase extends Model implements HasMedia
/**
* The attributes that aren't mass assignable.
*
* @var array
*/
protected $guarded = [];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'id' => 'integer',
'lat' => 'double',
'lon' => 'array',
'digital' => 'boolean',
'id' => 'integer',
'lat' => 'double',
'lon' => 'array',
'digital' => 'boolean',
'deactivated' => 'boolean',
];
protected static function booted()
{
static::creating(function ($model) {
if (!$model->created_by) {
if (! $model->created_by) {
$model->created_by = auth()->id();
}
});

View File

@@ -12,12 +12,14 @@ class Category extends Model
/**
* The attributes that aren't mass assignable.
*
* @var array
*/
protected $guarded = [];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [

View File

@@ -19,25 +19,27 @@ class City extends Model
/**
* The attributes that aren't mass assignable.
*
* @var array
*/
protected $guarded = [];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'id' => 'integer',
'country_id' => 'integer',
'osm_relation' => 'json',
'id' => 'integer',
'country_id' => 'integer',
'osm_relation' => 'json',
'simplified_geojson' => 'json',
];
protected static function booted()
{
static::creating(function ($model) {
if (!$model->created_by) {
if (! $model->created_by) {
$model->created_by = auth()->id();
}
});
@@ -69,12 +71,12 @@ class City extends Model
return $this->hasMany(Venue::class);
}
function courseEvents()
public function courseEvents()
{
return $this->hasManyThrough(CourseEvent::class, Venue::class);
}
function meetups()
public function meetups()
{
return $this->hasMany(Meetup::class);
}

View File

@@ -12,16 +12,18 @@ class Country extends Model
/**
* The attributes that aren't mass assignable.
*
* @var array
*/
protected $guarded = [];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'id' => 'integer',
'id' => 'integer',
'language_codes' => 'array',
];

View File

@@ -21,23 +21,25 @@ class Course extends Model implements HasMedia
/**
* The attributes that aren't mass assignable.
*
* @var array
*/
protected $guarded = [];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'id' => 'integer',
'id' => 'integer',
'lecturer_id' => 'integer',
];
protected static function booted()
{
static::creating(function ($model) {
if (!$model->created_by) {
if (! $model->created_by) {
$model->created_by = auth()->id();
}
});

View File

@@ -13,26 +13,28 @@ class CourseEvent extends Model
/**
* The attributes that aren't mass assignable.
*
* @var array
*/
protected $guarded = [];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'id' => 'integer',
'id' => 'integer',
'course_id' => 'integer',
'venue_id' => 'integer',
'from' => 'datetime',
'to' => 'datetime',
'venue_id' => 'integer',
'from' => 'datetime',
'to' => 'datetime',
];
protected static function booted()
{
static::creating(function ($model) {
if (!$model->created_by) {
if (! $model->created_by) {
$model->created_by = auth()->id();
}
});

View File

@@ -15,24 +15,26 @@ class Episode extends Model
/**
* The attributes that aren't mass assignable.
*
* @var array
*/
protected $guarded = [];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'id' => 'integer',
'id' => 'integer',
'podcast_id' => 'integer',
'data' => 'array',
'data' => 'array',
];
protected static function booted()
{
static::creating(function ($model) {
if (!$model->created_by) {
if (! $model->created_by) {
$model->created_by = auth()->id();
}
});

View File

@@ -23,26 +23,29 @@ class Lecturer extends Model implements HasMedia
/**
* The attributes that aren't mass assignable.
*
* @var array
*/
protected $guarded = [];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'id' => 'integer',
'id' => 'integer',
'team_id' => 'integer',
'active' => 'boolean',
'active' => 'boolean',
];
protected static function booted()
{
static::creating(function ($model) {
if (!$model->created_by) {
if (! $model->created_by) {
$model->created_by = auth()->id();
}
if (!$model->team_id) {
if (! $model->team_id) {
$model->team_id = auth()->user()->current_team_id;
}
});

View File

@@ -6,7 +6,6 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
class Library extends Model
{
@@ -14,23 +13,25 @@ class Library extends Model
/**
* The attributes that aren't mass assignable.
*
* @var array
*/
protected $guarded = [];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'id' => 'integer',
'id' => 'integer',
'language_codes' => 'array',
];
protected static function booted()
{
static::creating(function ($model) {
if (!$model->created_by) {
if (! $model->created_by) {
$model->created_by = auth()->id();
}
});
@@ -46,7 +47,7 @@ class Library extends Model
return $this->belongsToMany(LibraryItem::class);
}
public function parent() : BelongsTo
public function parent(): BelongsTo
{
return $this->belongsTo(__CLASS__, 'parent_id');
}

View File

@@ -31,18 +31,20 @@ class LibraryItem extends Model implements HasMedia, Sortable, Feedable
/**
* The attributes that aren't mass assignable.
*
* @var array
*/
protected $guarded = [];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'id' => 'integer',
'id' => 'integer',
'lecturer_id' => 'integer',
'library_id' => 'integer',
'library_id' => 'integer',
];
public static function getFeedItems()
@@ -61,7 +63,7 @@ class LibraryItem extends Model implements HasMedia, Sortable, Feedable
protected static function booted()
{
static::creating(function ($model) {
if (!$model->created_by) {
if (! $model->created_by) {
$model->created_by = auth()->id();
}
});
@@ -95,7 +97,7 @@ class LibraryItem extends Model implements HasMedia, Sortable, Feedable
$this->addMediaCollection('single_file')
->acceptsMimeTypes([
'application/pdf', 'application/zip', 'application/octet-stream', 'application/x-zip-compressed',
'multipart/x-zip'
'multipart/x-zip',
])
->singleFile();
$this->addMediaCollection('images')

View File

@@ -11,12 +11,14 @@ class LoginKey extends Model
/**
* The attributes that aren't mass assignable.
*
* @var array
*/
protected $guarded = [];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [];

View File

@@ -23,24 +23,27 @@ class Meetup extends Model implements HasMedia
/**
* The attributes that aren't mass assignable.
*
* @var array
*/
protected $guarded = [];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'id' => 'integer',
'city_id' => 'integer',
'github_data' => 'json',
'id' => 'integer',
'city_id' => 'integer',
'github_data' => 'json',
'simplified_geojson' => 'array',
];
protected static function booted()
{
static::creating(function ($model) {
if (!$model->created_by) {
if (! $model->created_by) {
$model->created_by = auth()->id();
}
});
@@ -103,13 +106,13 @@ class Meetup extends Model implements HasMedia
}
return Attribute::make(
get: fn() => url()->route('img',
get: fn () => url()->route('img',
[
'path' => $path,
'w' => 900,
'h' => 900,
'fit' => 'crop',
'fm' => 'webp'
'w' => 900,
'h' => 900,
'fit' => 'crop',
'fm' => 'webp',
]),
);
}

View File

@@ -14,26 +14,28 @@ class MeetupEvent extends Model
/**
* The attributes that aren't mass assignable.
*
* @var array
*/
protected $guarded = [];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'id' => 'integer',
'meetup_id' => 'integer',
'start' => 'datetime',
'attendees' => 'array',
'id' => 'integer',
'meetup_id' => 'integer',
'start' => 'datetime',
'attendees' => 'array',
'might_attendees' => 'array',
];
protected static function booted()
{
static::creating(function ($model) {
if (!$model->created_by) {
if (! $model->created_by) {
$model->created_by = auth()->id();
}
});
@@ -64,6 +66,6 @@ class MeetupEvent extends Model
*/
public function commentUrl(): string
{
return url()->route('meetup.event.landing', ['country' => $this->meetup->city->country,'meetupEvent' => $this]);
return url()->route('meetup.event.landing', ['country' => $this->meetup->city->country, 'meetupEvent' => $this]);
}
}

View File

@@ -8,6 +8,7 @@ class Membership extends JetstreamMembership
{
/**
* Indicates if the IDs are auto-incrementing.
*
* @var bool
*/
public $incrementing = true;

View File

@@ -18,19 +18,21 @@ class OrangePill extends Model implements HasMedia
/**
* The attributes that aren't mass assignable.
*
* @var array
*/
protected $guarded = [];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'id' => 'integer',
'user_id' => 'integer',
'id' => 'integer',
'user_id' => 'integer',
'book_case_id' => 'integer',
'date' => 'datetime',
'date' => 'datetime',
];
protected static function booted()

View File

@@ -11,12 +11,14 @@ class Participant extends Model
/**
* The attributes that aren't mass assignable.
*
* @var array
*/
protected $guarded = [];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [

View File

@@ -13,23 +13,25 @@ class Podcast extends Model
/**
* The attributes that aren't mass assignable.
*
* @var array
*/
protected $guarded = [];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'id' => 'integer',
'id' => 'integer',
'data' => 'array',
];
protected static function booted()
{
static::creating(function ($model) {
if (!$model->created_by) {
if (! $model->created_by) {
$model->created_by = auth()->id();
}
});

View File

@@ -12,19 +12,21 @@ class Registration extends Model
/**
* The attributes that aren't mass assignable.
*
* @var array
*/
protected $guarded = [];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'id' => 'integer',
'event_id' => 'integer',
'id' => 'integer',
'event_id' => 'integer',
'participant_id' => 'integer',
'active' => 'boolean',
'active' => 'boolean',
];
public function courseEvent(): BelongsTo

View File

@@ -13,7 +13,6 @@ class ActiveBookCases implements Scope
*
* @param \Illuminate\Database\Eloquent\Builder $builder
* @param \Illuminate\Database\Eloquent\Model $model
*
* @return void
*/
public function apply(Builder $builder, Model $model)

View File

@@ -14,6 +14,7 @@ class Team extends JetstreamTeam
/**
* The attributes that should be cast.
*
* @var array
*/
protected $casts = [
@@ -22,6 +23,7 @@ class Team extends JetstreamTeam
/**
* The attributes that are mass assignable.
*
* @var string[]
*/
protected $fillable = [
@@ -31,6 +33,7 @@ class Team extends JetstreamTeam
/**
* The event map for the model.
*
* @var array
*/
protected $dispatchesEvents = [

View File

@@ -9,6 +9,7 @@ class TeamInvitation extends JetstreamTeamInvitation
{
/**
* The attributes that are mass assignable.
*
* @var string[]
*/
protected $fillable = [
@@ -18,6 +19,7 @@ class TeamInvitation extends JetstreamTeamInvitation
/**
* Get the team that the invitation belongs to.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function team()

View File

@@ -10,14 +10,14 @@ use Laravel\Fortify\TwoFactorAuthenticatable;
use Laravel\Jetstream\HasProfilePhoto;
use Laravel\Jetstream\HasTeams;
use Laravel\Sanctum\HasApiTokens;
use ParagonIE\CipherSweet\BlindIndex;
use ParagonIE\CipherSweet\EncryptedRow;
use QCod\Gamify\Gamify;
use Spatie\Comments\Models\Concerns\InteractsWithComments;
use Spatie\Comments\Models\Concerns\Interfaces\CanComment;
use Spatie\LaravelCipherSweet\Concerns\UsesCipherSweet;
use Spatie\LaravelCipherSweet\Contracts\CipherSweetEncrypted;
use Spatie\Permission\Traits\HasRoles;
use ParagonIE\CipherSweet\EncryptedRow;
use ParagonIE\CipherSweet\BlindIndex;
class User extends Authenticatable implements MustVerifyEmail, CanComment, CipherSweetEncrypted
{
@@ -36,6 +36,7 @@ class User extends Authenticatable implements MustVerifyEmail, CanComment, Ciphe
/**
* The attributes that should be hidden for serialization.
*
* @var array
*/
protected $hidden = [
@@ -47,6 +48,7 @@ class User extends Authenticatable implements MustVerifyEmail, CanComment, Ciphe
/**
* The attributes that should be cast.
*
* @var array
*/
protected $casts = [
@@ -55,6 +57,7 @@ class User extends Authenticatable implements MustVerifyEmail, CanComment, Ciphe
/**
* The accessors to append to the model's array form.
*
* @var array
*/
protected $appends = [

View File

@@ -24,23 +24,25 @@ class Venue extends Model implements HasMedia
/**
* The attributes that aren't mass assignable.
*
* @var array
*/
protected $guarded = [];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'id' => 'integer',
'id' => 'integer',
'city_id' => 'integer',
];
protected static function booted()
{
static::creating(function ($model) {
if (!$model->created_by) {
if (! $model->created_by) {
$model->created_by = auth()->id();
}
});
@@ -70,7 +72,7 @@ class Venue extends Model implements HasMedia
public function getSlugOptions(): SlugOptions
{
return SlugOptions::create()
->generateSlugsFrom(['city.slug', 'name',])
->generateSlugsFrom(['city.slug', 'name'])
->saveSlugsTo('slug')
->usingLanguage(Cookie::get('lang', config('app.locale')));
}