diff --git a/app/Console/Commands/Feed/ReadAndSyncEinundzwanzigPodcastFeed.php b/app/Console/Commands/Feed/ReadAndSyncEinundzwanzigPodcastFeed.php index 7f71eaf4..ae711b64 100644 --- a/app/Console/Commands/Feed/ReadAndSyncEinundzwanzigPodcastFeed.php +++ b/app/Console/Commands/Feed/ReadAndSyncEinundzwanzigPodcastFeed.php @@ -39,6 +39,7 @@ class ReadAndSyncEinundzwanzigPodcastFeed extends Command 'link' => $podcast->feed->link, 'language_code' => $podcast->feed->language, 'data' => $podcast->feed, + 'created_by' => 1, ]); $episodes = $client->episodes->byFeedUrl('https://einundzwanzig.space/feed.xml') ->json(); @@ -47,6 +48,7 @@ class ReadAndSyncEinundzwanzigPodcastFeed extends Command ->updateOrCreate(['guid' => $item->guid], [ 'podcast_id' => $einundzwanzigPodcast->id, 'data' => $item, + 'created_by' => 1, ]); } diff --git a/app/Console/Commands/OpenBooks/SyncOpenBooks.php b/app/Console/Commands/OpenBooks/SyncOpenBooks.php index 38142d47..345feb51 100644 --- a/app/Console/Commands/OpenBooks/SyncOpenBooks.php +++ b/app/Console/Commands/OpenBooks/SyncOpenBooks.php @@ -49,6 +49,7 @@ class SyncOpenBooks extends Command 'deactreason' => $case['deactreason'], 'entrytype' => $case['entrytype'], 'homepage' => $case['homepage'], + 'created_by' => 1, ] ); } diff --git a/app/Models/BitcoinEvent.php b/app/Models/BitcoinEvent.php index eaa4c244..a50ca933 100644 --- a/app/Models/BitcoinEvent.php +++ b/app/Models/BitcoinEvent.php @@ -51,6 +51,11 @@ class BitcoinEvent extends Model implements HasMedia ->useFallbackUrl(asset('img/einundzwanzig-cover-lesestunde.png')); } + public function createdBy(): \Illuminate\Database\Eloquent\Relations\BelongsTo + { + return $this->belongsTo(User::class, 'created_by'); + } + public function venue(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(Venue::class); diff --git a/app/Models/BookCase.php b/app/Models/BookCase.php index ab792f8b..f7d59868 100644 --- a/app/Models/BookCase.php +++ b/app/Models/BookCase.php @@ -54,6 +54,11 @@ class BookCase extends Model implements HasMedia $this->addMediaCollection('images'); } + public function createdBy(): \Illuminate\Database\Eloquent\Relations\BelongsTo + { + return $this->belongsTo(User::class, 'created_by'); + } + public function orangePills(): HasMany { return $this->hasMany(OrangePill::class); diff --git a/app/Models/City.php b/app/Models/City.php index b5d23ff1..b4c8c321 100644 --- a/app/Models/City.php +++ b/app/Models/City.php @@ -40,6 +40,11 @@ class City extends Model ->usingLanguage('de'); } + public function createdBy(): \Illuminate\Database\Eloquent\Relations\BelongsTo + { + return $this->belongsTo(User::class, 'created_by'); + } + public function country(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(Country::class); diff --git a/app/Models/Course.php b/app/Models/Course.php index 4e2301cc..fe4a41ab 100644 --- a/app/Models/Course.php +++ b/app/Models/Course.php @@ -54,6 +54,11 @@ class Course extends Model implements HasMedia ->useFallbackUrl(asset('img/einundzwanzig-cover-lesestunde.png')); } + public function createdBy(): \Illuminate\Database\Eloquent\Relations\BelongsTo + { + return $this->belongsTo(User::class, 'created_by'); + } + public function categories(): \Illuminate\Database\Eloquent\Relations\BelongsToMany { return $this->belongsToMany(Category::class); diff --git a/app/Models/CourseEvent.php b/app/Models/CourseEvent.php index 53263274..f97bf297 100644 --- a/app/Models/CourseEvent.php +++ b/app/Models/CourseEvent.php @@ -29,6 +29,11 @@ class CourseEvent extends Model 'to' => 'datetime', ]; + public function createdBy(): \Illuminate\Database\Eloquent\Relations\BelongsTo + { + return $this->belongsTo(User::class, 'created_by'); + } + public function course(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(Course::class); diff --git a/app/Models/Episode.php b/app/Models/Episode.php index 4b62d5e7..c78667bd 100644 --- a/app/Models/Episode.php +++ b/app/Models/Episode.php @@ -28,6 +28,11 @@ class Episode extends Model 'data' => 'array', ]; + public function createdBy(): \Illuminate\Database\Eloquent\Relations\BelongsTo + { + return $this->belongsTo(User::class, 'created_by'); + } + public function podcast(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(Podcast::class); diff --git a/app/Models/Lecturer.php b/app/Models/Lecturer.php index 844a4093..3a4cb149 100644 --- a/app/Models/Lecturer.php +++ b/app/Models/Lecturer.php @@ -64,6 +64,11 @@ class Lecturer extends Model implements HasMedia ->usingLanguage('de'); } + public function createdBy(): \Illuminate\Database\Eloquent\Relations\BelongsTo + { + return $this->belongsTo(User::class, 'created_by'); + } + public function team(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(Team::class); diff --git a/app/Models/Library.php b/app/Models/Library.php index 3fb15bdd..d20245b0 100644 --- a/app/Models/Library.php +++ b/app/Models/Library.php @@ -26,6 +26,11 @@ class Library extends Model 'language_codes' => 'array', ]; + public function createdBy(): \Illuminate\Database\Eloquent\Relations\BelongsTo + { + return $this->belongsTo(User::class, 'created_by'); + } + public function libraryItems(): \Illuminate\Database\Eloquent\Relations\BelongsToMany { return $this->belongsToMany(LibraryItem::class); diff --git a/app/Models/LibraryItem.php b/app/Models/LibraryItem.php index 7a813afa..fa19df37 100644 --- a/app/Models/LibraryItem.php +++ b/app/Models/LibraryItem.php @@ -59,6 +59,11 @@ class LibraryItem extends Model implements HasMedia, Sortable ->useFallbackUrl(asset('img/einundzwanzig-cover-lesestunde.png')); } + public function createdBy(): \Illuminate\Database\Eloquent\Relations\BelongsTo + { + return $this->belongsTo(User::class, 'created_by'); + } + public function lecturer(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(Lecturer::class); diff --git a/app/Models/Meetup.php b/app/Models/Meetup.php index 5ab46043..1e17c575 100644 --- a/app/Models/Meetup.php +++ b/app/Models/Meetup.php @@ -48,6 +48,11 @@ class Meetup extends Model implements HasMedia ->useFallbackUrl(asset('img/einundzwanzig-cover-lesestunde.png')); } + public function createdBy(): \Illuminate\Database\Eloquent\Relations\BelongsTo + { + return $this->belongsTo(User::class, 'created_by'); + } + public function city(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(City::class); diff --git a/app/Models/MeetupEvent.php b/app/Models/MeetupEvent.php index 5cb14f6d..00f4cfa6 100644 --- a/app/Models/MeetupEvent.php +++ b/app/Models/MeetupEvent.php @@ -27,6 +27,11 @@ class MeetupEvent extends Model 'start' => 'datetime', ]; + public function createdBy(): \Illuminate\Database\Eloquent\Relations\BelongsTo + { + return $this->belongsTo(User::class, 'created_by'); + } + public function meetup(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(Meetup::class); diff --git a/app/Models/Podcast.php b/app/Models/Podcast.php index c6e8c506..979405ff 100644 --- a/app/Models/Podcast.php +++ b/app/Models/Podcast.php @@ -25,6 +25,11 @@ class Podcast extends Model 'data' => 'array', ]; + public function createdBy(): \Illuminate\Database\Eloquent\Relations\BelongsTo + { + return $this->belongsTo(User::class, 'created_by'); + } + public function episodes(): HasMany { return $this->hasMany(Episode::class); diff --git a/app/Models/Venue.php b/app/Models/Venue.php index 2bbaabe3..fabec0cf 100644 --- a/app/Models/Venue.php +++ b/app/Models/Venue.php @@ -63,6 +63,11 @@ class Venue extends Model implements HasMedia ->usingLanguage('de'); } + public function createdBy(): \Illuminate\Database\Eloquent\Relations\BelongsTo + { + return $this->belongsTo(User::class, 'created_by'); + } + public function city(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(City::class); diff --git a/app/Nova/BitcoinEvent.php b/app/Nova/BitcoinEvent.php index 9cc49bb3..0d0c4fd3 100644 --- a/app/Nova/BitcoinEvent.php +++ b/app/Nova/BitcoinEvent.php @@ -66,6 +66,8 @@ class BitcoinEvent extends Resource BelongsTo::make(__('Venue'), 'venue', Venue::class)->searchable(), + BelongsTo::make(__('Created By'), 'createdBy', User::class), + ]; } diff --git a/app/Nova/BookCase.php b/app/Nova/BookCase.php index caf83858..ff0315ee 100644 --- a/app/Nova/BookCase.php +++ b/app/Nova/BookCase.php @@ -3,6 +3,7 @@ namespace App\Nova; use Illuminate\Http\Request; +use Laravel\Nova\Fields\BelongsTo; use Laravel\Nova\Fields\Boolean; use Laravel\Nova\Fields\HasMany; use Laravel\Nova\Fields\ID; @@ -112,6 +113,8 @@ class BookCase extends Resource MorphMany::make(__('Comments'), 'comments', Comment::class), + BelongsTo::make(__('Created By'), 'createdBy', User::class), + ]; } diff --git a/app/Nova/City.php b/app/Nova/City.php index 8f85a787..a1bdc6b7 100644 --- a/app/Nova/City.php +++ b/app/Nova/City.php @@ -75,6 +75,8 @@ class City extends Resource HasMany::make(__('Meetups'), 'meetups', Meetup::class), + BelongsTo::make(__('Created By'), 'createdBy', User::class), + ]; } diff --git a/app/Nova/Course.php b/app/Nova/Course.php index 67a2abc4..fdabda88 100644 --- a/app/Nova/Course.php +++ b/app/Nova/Course.php @@ -98,6 +98,8 @@ class Course extends Resource BelongsToMany::make(__('Categories'), 'categories', Category::class) ->onlyOnDetail(), + BelongsTo::make(__('Created By'), 'createdBy', User::class), + ]; } diff --git a/app/Nova/CourseEvent.php b/app/Nova/CourseEvent.php index c6cd93cb..255f8fc4 100644 --- a/app/Nova/CourseEvent.php +++ b/app/Nova/CourseEvent.php @@ -79,6 +79,8 @@ class CourseEvent extends Resource BelongsTo::make(__('Venue'), 'venue', Venue::class) ->searchable(), + BelongsTo::make(__('Created By'), 'createdBy', User::class), + ]; } diff --git a/app/Nova/Episode.php b/app/Nova/Episode.php index 38834317..1379d473 100644 --- a/app/Nova/Episode.php +++ b/app/Nova/Episode.php @@ -52,7 +52,6 @@ class Episode extends Resource 'language_code' => $model->podcast->language_code, 'value' => null, ]); - ray($request->tags); $libraryItem->syncTagsWithType(is_array($request->tags) ? $request->tags : str($request->tags)->explode('-----'), 'library_item'); $libraryItem->addMediaFromUrl($model->data['image']) @@ -103,6 +102,8 @@ class Episode extends Resource BelongsTo::make(__('Podcast'), 'podcast', Podcast::class) ->readonly(), + BelongsTo::make(__('Created By'), 'createdBy', User::class), + ]; } diff --git a/app/Nova/Lecturer.php b/app/Nova/Lecturer.php index 2fe85ba0..b3105a81 100644 --- a/app/Nova/Lecturer.php +++ b/app/Nova/Lecturer.php @@ -86,6 +86,8 @@ class Lecturer extends Resource BelongsTo::make('Team'), + BelongsTo::make(__('Created By'), 'createdBy', User::class), + ]; } diff --git a/app/Nova/Library.php b/app/Nova/Library.php index f64e2b4d..5443c4f1 100644 --- a/app/Nova/Library.php +++ b/app/Nova/Library.php @@ -3,6 +3,7 @@ namespace App\Nova; use Illuminate\Http\Request; +use Laravel\Nova\Fields\BelongsTo; use Laravel\Nova\Fields\BelongsToMany; use Laravel\Nova\Fields\Boolean; use Laravel\Nova\Fields\ID; @@ -62,6 +63,9 @@ class Library extends Resource ), BelongsToMany::make('Library Items'), + + BelongsTo::make(__('Created By'), 'createdBy', User::class), + ]; } diff --git a/app/Nova/LibraryItem.php b/app/Nova/LibraryItem.php index c2152d2b..c1bbd1ee 100644 --- a/app/Nova/LibraryItem.php +++ b/app/Nova/LibraryItem.php @@ -95,6 +95,8 @@ class LibraryItem extends Resource BelongsToMany::make(__('Library'), 'libraries', Library::class), + BelongsTo::make(__('Created By'), 'createdBy', User::class), + ]; } diff --git a/app/Nova/Meetup.php b/app/Nova/Meetup.php index 2f26a4e2..09fdcca4 100644 --- a/app/Nova/Meetup.php +++ b/app/Nova/Meetup.php @@ -56,6 +56,8 @@ class Meetup extends Resource BelongsTo::make(__('City'), 'city', City::class)->searchable(), + BelongsTo::make(__('Created By'), 'createdBy', User::class), + ]; } diff --git a/app/Nova/MeetupEvent.php b/app/Nova/MeetupEvent.php index f184a764..d45f74d2 100644 --- a/app/Nova/MeetupEvent.php +++ b/app/Nova/MeetupEvent.php @@ -62,6 +62,8 @@ class MeetupEvent extends Resource BelongsTo::make('Meetup') ->searchable(), + BelongsTo::make(__('Created By'), 'createdBy', User::class), + ]; } diff --git a/app/Nova/Podcast.php b/app/Nova/Podcast.php index 60df6dfb..0be80a32 100644 --- a/app/Nova/Podcast.php +++ b/app/Nova/Podcast.php @@ -5,6 +5,7 @@ namespace App\Nova; use Illuminate\Http\Request; use Illuminate\Support\Str; use Laravel\Nova\Fields\Avatar; +use Laravel\Nova\Fields\BelongsTo; use Laravel\Nova\Fields\Boolean; use Laravel\Nova\Fields\Code; use Laravel\Nova\Fields\HasMany; @@ -80,6 +81,9 @@ class Podcast extends Resource ->json(), HasMany::make(__('Episodes'), 'episodes', Episode::class), + + BelongsTo::make(__('Created By'), 'createdBy', User::class), + ]; } diff --git a/app/Nova/Venue.php b/app/Nova/Venue.php index 0ac7cee9..c5fb6386 100644 --- a/app/Nova/Venue.php +++ b/app/Nova/Venue.php @@ -63,6 +63,8 @@ class Venue extends Resource BelongsTo::make(__('City'), 'city', City::class), + BelongsTo::make(__('Created By'), 'createdBy', User::class), + ]; } diff --git a/app/Policies/BasePolicy.php b/app/Policies/BasePolicy.php index a4d0a2b8..3a443dfe 100644 --- a/app/Policies/BasePolicy.php +++ b/app/Policies/BasePolicy.php @@ -16,7 +16,7 @@ class BasePolicy */ public function before(User $user, $ability) { - if ($user->hasRole('super-admin') || app()->environment('local')) { + if ($user->hasRole('super-admin') || config('app.super-admin')) { return true; } } diff --git a/app/Policies/BitcoinEventPolicy.php b/app/Policies/BitcoinEventPolicy.php new file mode 100644 index 00000000..99073f3e --- /dev/null +++ b/app/Policies/BitcoinEventPolicy.php @@ -0,0 +1,101 @@ +created_by === $user->id; + } + + /** + * Determine whether the user can delete the model. + * + * @param \App\Models\User $user + * @param \App\Models\BitcoinEvent $bitcoinEvent + * + * @return \Illuminate\Auth\Access\Response|bool + */ + public function delete(User $user, BitcoinEvent $bitcoinEvent) + { + // + } + + /** + * Determine whether the user can restore the model. + * + * @param \App\Models\User $user + * @param \App\Models\BitcoinEvent $bitcoinEvent + * + * @return \Illuminate\Auth\Access\Response|bool + */ + public function restore(User $user, BitcoinEvent $bitcoinEvent) + { + // + } + + /** + * Determine whether the user can permanently delete the model. + * + * @param \App\Models\User $user + * @param \App\Models\BitcoinEvent $bitcoinEvent + * + * @return \Illuminate\Auth\Access\Response|bool + */ + public function forceDelete(User $user, BitcoinEvent $bitcoinEvent) + { + // + } +} diff --git a/app/Policies/CityPolicy.php b/app/Policies/CityPolicy.php index dff11f0d..467684ea 100644 --- a/app/Policies/CityPolicy.php +++ b/app/Policies/CityPolicy.php @@ -53,7 +53,7 @@ class CityPolicy extends BasePolicy */ public function update(User $user, City $city) { - return $user->is_lecturer; + return $city->created_by === $user->id; } /** diff --git a/app/Policies/LecturerPolicy.php b/app/Policies/LecturerPolicy.php index 028b6d06..8ca0ea11 100644 --- a/app/Policies/LecturerPolicy.php +++ b/app/Policies/LecturerPolicy.php @@ -57,7 +57,7 @@ class LecturerPolicy extends BasePolicy */ public function update(User $user, Lecturer $lecturer) { - return $user->belongsToTeam($lecturer->team); + return $lecturer->created_by === $user->id; } /** diff --git a/app/Policies/LibraryItemPolicy.php b/app/Policies/LibraryItemPolicy.php index e3a2f64e..3470eae2 100644 --- a/app/Policies/LibraryItemPolicy.php +++ b/app/Policies/LibraryItemPolicy.php @@ -53,7 +53,7 @@ class LibraryItemPolicy extends BasePolicy */ public function update(User $user, LibraryItem $libraryItem) { - return false; + return $libraryItem->created_by === $user->id; } /** diff --git a/app/Policies/LibraryPolicy.php b/app/Policies/LibraryPolicy.php index ffbfc3cd..9966985e 100644 --- a/app/Policies/LibraryPolicy.php +++ b/app/Policies/LibraryPolicy.php @@ -53,7 +53,7 @@ class LibraryPolicy extends BasePolicy */ public function update(User $user, Library $library) { - return false; + return $library->created_by === $user->id; } /** diff --git a/app/Policies/MeetupEventPolicy.php b/app/Policies/MeetupEventPolicy.php index 6f9d7ef6..ac828ca5 100644 --- a/app/Policies/MeetupEventPolicy.php +++ b/app/Policies/MeetupEventPolicy.php @@ -53,7 +53,7 @@ class MeetupEventPolicy extends BasePolicy */ public function update(User $user, MeetupEvent $meetupEvent) { - return false; + return $meetupEvent->created_by === $user->id; } /** diff --git a/app/Policies/MeetupPolicy.php b/app/Policies/MeetupPolicy.php index a50b81f2..ebed96b8 100644 --- a/app/Policies/MeetupPolicy.php +++ b/app/Policies/MeetupPolicy.php @@ -57,7 +57,7 @@ class MeetupPolicy extends BasePolicy */ public function update(User $user, Meetup $meetup) { - return false; + return $meetup->created_by === $user->id; } /** diff --git a/app/Policies/OrangePillPolicy.php b/app/Policies/OrangePillPolicy.php index eede9e26..03763bdf 100644 --- a/app/Policies/OrangePillPolicy.php +++ b/app/Policies/OrangePillPolicy.php @@ -14,6 +14,7 @@ class OrangePillPolicy extends BasePolicy * Determine whether the user can view any models. * * @param \App\Models\User $user + * * @return \Illuminate\Auth\Access\Response|bool */ public function viewAny(User $user) @@ -26,6 +27,7 @@ class OrangePillPolicy extends BasePolicy * * @param \App\Models\User $user * @param \App\Models\OrangePill $orangePill + * * @return \Illuminate\Auth\Access\Response|bool */ public function view(User $user, OrangePill $orangePill) @@ -37,6 +39,7 @@ class OrangePillPolicy extends BasePolicy * Determine whether the user can create models. * * @param \App\Models\User $user + * * @return \Illuminate\Auth\Access\Response|bool */ public function create(User $user) @@ -49,11 +52,12 @@ class OrangePillPolicy extends BasePolicy * * @param \App\Models\User $user * @param \App\Models\OrangePill $orangePill + * * @return \Illuminate\Auth\Access\Response|bool */ public function update(User $user, OrangePill $orangePill) { - return false; + return $orangePill->user_id === $user->id; } /** @@ -61,6 +65,7 @@ class OrangePillPolicy extends BasePolicy * * @param \App\Models\User $user * @param \App\Models\OrangePill $orangePill + * * @return \Illuminate\Auth\Access\Response|bool */ public function delete(User $user, OrangePill $orangePill) @@ -73,6 +78,7 @@ class OrangePillPolicy extends BasePolicy * * @param \App\Models\User $user * @param \App\Models\OrangePill $orangePill + * * @return \Illuminate\Auth\Access\Response|bool */ public function restore(User $user, OrangePill $orangePill) @@ -85,6 +91,7 @@ class OrangePillPolicy extends BasePolicy * * @param \App\Models\User $user * @param \App\Models\OrangePill $orangePill + * * @return \Illuminate\Auth\Access\Response|bool */ public function forceDelete(User $user, OrangePill $orangePill) diff --git a/app/Policies/VenuePolicy.php b/app/Policies/VenuePolicy.php index 3818191e..71a3ac13 100644 --- a/app/Policies/VenuePolicy.php +++ b/app/Policies/VenuePolicy.php @@ -57,8 +57,7 @@ class VenuePolicy extends BasePolicy */ public function update(User $user, Venue $venue) { - return $venue->lecturers->where('team_id', $user->current_team_id) - ->isNotEmpty(); + return $venue->created_by === $user->id; } /** diff --git a/composer.lock b/composer.lock index c2773afa..aaa520c6 100644 --- a/composer.lock +++ b/composer.lock @@ -13011,16 +13011,16 @@ }, { "name": "laravel-lang/lang", - "version": "12.7.0", + "version": "12.7.2", "source": { "type": "git", "url": "https://github.com/Laravel-Lang/lang.git", - "reference": "d900bc6dc001a8ca63cc13184c0720d4262e0d23" + "reference": "839ce5d81cd4a8deda5c09bb74af995371345c5b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Laravel-Lang/lang/zipball/d900bc6dc001a8ca63cc13184c0720d4262e0d23", - "reference": "d900bc6dc001a8ca63cc13184c0720d4262e0d23", + "url": "https://api.github.com/repos/Laravel-Lang/lang/zipball/839ce5d81cd4a8deda5c09bb74af995371345c5b", + "reference": "839ce5d81cd4a8deda5c09bb74af995371345c5b", "shasum": "" }, "require": { @@ -13082,7 +13082,7 @@ "type": "open_collective" } ], - "time": "2022-12-14T07:53:56+00:00" + "time": "2022-12-14T13:47:21+00:00" }, { "name": "laravel-lang/publisher", @@ -13820,16 +13820,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.20", + "version": "9.2.21", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "af7463c955007de36db0c5e26d03e2f933c2e980" + "reference": "3f893e19712bb0c8bc86665d1562e9fd509c4ef0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/af7463c955007de36db0c5e26d03e2f933c2e980", - "reference": "af7463c955007de36db0c5e26d03e2f933c2e980", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/3f893e19712bb0c8bc86665d1562e9fd509c4ef0", + "reference": "3f893e19712bb0c8bc86665d1562e9fd509c4ef0", "shasum": "" }, "require": { @@ -13885,7 +13885,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.20" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.21" }, "funding": [ { @@ -13893,7 +13893,7 @@ "type": "github" } ], - "time": "2022-12-13T07:49:28+00:00" + "time": "2022-12-14T13:26:54+00:00" }, { "name": "phpunit/php-file-iterator", diff --git a/config/app.php b/config/app.php index 89982966..ae0c0526 100644 --- a/config/app.php +++ b/config/app.php @@ -4,6 +4,8 @@ use Illuminate\Support\Facades\Facade; return [ + 'super-admin' => env('SUPERADMIN', false), + /* |-------------------------------------------------------------------------- | Application Name diff --git a/database/migrations/2022_12_14_123437_create_created_by_fields_on_all_tables.php b/database/migrations/2022_12_14_123437_create_created_by_fields_on_all_tables.php new file mode 100644 index 00000000..4884a938 --- /dev/null +++ b/database/migrations/2022_12_14_123437_create_created_by_fields_on_all_tables.php @@ -0,0 +1,117 @@ +foreignId('created_by') + ->default(1) + ->constrained('users') + ->cascadeOnDelete() + ->cascadeOnUpdate(); + }); + Schema::table('venues', function (Blueprint $table) { + $table->foreignId('created_by') + ->default(1) + ->constrained('users') + ->cascadeOnDelete() + ->cascadeOnUpdate(); + }); + Schema::table('lecturers', function (Blueprint $table) { + $table->foreignId('created_by') + ->default(1) + ->constrained('users') + ->cascadeOnDelete() + ->cascadeOnUpdate(); + }); + Schema::table('meetups', function (Blueprint $table) { + $table->foreignId('created_by') + ->default(1) + ->constrained('users') + ->cascadeOnDelete() + ->cascadeOnUpdate(); + }); + Schema::table('meetup_events', function (Blueprint $table) { + $table->foreignId('created_by') + ->default(1) + ->constrained('users') + ->cascadeOnDelete() + ->cascadeOnUpdate(); + }); + Schema::table('bitcoin_events', function (Blueprint $table) { + $table->foreignId('created_by') + ->default(1) + ->constrained('users') + ->cascadeOnDelete() + ->cascadeOnUpdate(); + }); + Schema::table('courses', function (Blueprint $table) { + $table->foreignId('created_by') + ->default(1) + ->constrained('users') + ->cascadeOnDelete() + ->cascadeOnUpdate(); + }); + Schema::table('course_events', function (Blueprint $table) { + $table->foreignId('created_by') + ->default(1) + ->constrained('users') + ->cascadeOnDelete() + ->cascadeOnUpdate(); + }); + Schema::table('libraries', function (Blueprint $table) { + $table->foreignId('created_by') + ->default(1) + ->constrained('users') + ->cascadeOnDelete() + ->cascadeOnUpdate(); + }); + Schema::table('library_items', function (Blueprint $table) { + $table->foreignId('created_by') + ->default(1) + ->constrained('users') + ->cascadeOnDelete() + ->cascadeOnUpdate(); + }); + Schema::table('podcasts', function (Blueprint $table) { + $table->foreignId('created_by') + ->default(1) + ->constrained('users') + ->cascadeOnDelete() + ->cascadeOnUpdate(); + }); + Schema::table('episodes', function (Blueprint $table) { + $table->foreignId('created_by') + ->default(1) + ->constrained('users') + ->cascadeOnDelete() + ->cascadeOnUpdate(); + }); + Schema::table('book_cases', function (Blueprint $table) { + $table->foreignId('created_by') + ->default(1) + ->constrained('users') + ->cascadeOnDelete() + ->cascadeOnUpdate(); + }); + } + + /** + * Reverse the migrations. + * @return void + */ + public function down() + { + Schema::table('cities', function (Blueprint $table) { + // + }); + } +}; diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index be6ae86e..021018d2 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -81,70 +81,83 @@ class DatabaseSeeder extends Seeder 'name' => 'Füssen', 'latitude' => 47.57143, 'longitude' => 10.70171, + 'created_by' => 1, ]); City::create([ 'country_id' => 1, 'name' => 'Kempten', 'latitude' => 47.728569, 'longitude' => 10.315784, + 'created_by' => 1, ]); City::create([ 'country_id' => 1, 'name' => 'Pfronten', 'latitude' => 47.582359, 'longitude' => 10.5598, + 'created_by' => 1, ]); City::create([ 'country_id' => 2, 'name' => 'Wien', 'latitude' => 48.20835, 'longitude' => 16.37250, + 'created_by' => 1, ]); City::create([ 'country_id' => 3, 'name' => 'Zürich', 'latitude' => 47.41330, 'longitude' => 8.65639, + 'created_by' => 1, ]); Venue::create([ 'city_id' => 1, 'name' => 'The Blue Studio Coworking (Füssen)', 'street' => 'Teststraße 1', + 'created_by' => 1, ]); Venue::create([ 'city_id' => 2, 'name' => 'The Blue Studio Coworking (Kempten)', 'street' => 'Teststraße 2', + 'created_by' => 1, ]); Venue::create([ 'city_id' => 3, 'name' => 'The Blue Studio Coworking (Pfronten)', 'street' => 'Teststraße 3', + 'created_by' => 1, ]); Venue::create([ 'city_id' => 4, 'name' => 'Innsbruck', 'street' => 'Innsbrucker Straße 1', + 'created_by' => 1, ]); Lecturer::create([ 'team_id' => 1, 'name' => 'Markus Turm', 'active' => true, + 'created_by' => 1, ]); Lecturer::create([ 'team_id' => 1, 'name' => 'Beppo', 'active' => true, + 'created_by' => 1, ]); Lecturer::create([ 'team_id' => 1, 'name' => 'Helper', 'active' => true, + 'created_by' => 1, ]); Lecturer::create([ 'team_id' => 1, 'name' => 'Gigi', 'active' => true, + 'created_by' => 1, ]); $category = Category::create([ 'name' => 'Präsenzunterricht', @@ -157,6 +170,7 @@ class DatabaseSeeder extends Seeder $course = Course::create([ 'lecturer_id' => 1, 'name' => 'Hands on Bitcoin', + 'created_by' => 1, ]); $course->syncTagsWithType(['Hardware Wallet'], 'course'); $course->categories() @@ -164,6 +178,7 @@ class DatabaseSeeder extends Seeder $course = Course::create([ 'lecturer_id' => 1, 'name' => 'Bitcoin <> Crypto', + 'created_by' => 1, ]); $course->syncTagsWithType(['Lightning'], 'course'); $course->categories() @@ -171,6 +186,7 @@ class DatabaseSeeder extends Seeder $course = Course::create([ 'lecturer_id' => 2, 'name' => 'Bitcoin Lightning Network', + 'created_by' => 1, ]); $course->syncTagsWithType(['Für Unternehmen'], 'course'); $course->categories() @@ -190,6 +206,7 @@ class DatabaseSeeder extends Seeder ->addDays(14) ->startOfDay() ->addHour(), + 'created_by' => 1, ]); CourseEvent::create([ 'course_id' => 1, @@ -202,6 +219,7 @@ class DatabaseSeeder extends Seeder ->addDays(3) ->startOfDay() ->addHour(), + 'created_by' => 1, ]); CourseEvent::create([ 'course_id' => 1, @@ -214,6 +232,7 @@ class DatabaseSeeder extends Seeder ->addDays(4) ->startOfDay() ->addHour(), + 'created_by' => 1, ]); CourseEvent::create([ 'course_id' => 3, @@ -226,6 +245,7 @@ class DatabaseSeeder extends Seeder ->addDays(4) ->startOfDay() ->addHour(), + 'created_by' => 1, ]); Registration::create([ 'course_event_id' => 1, @@ -234,6 +254,7 @@ class DatabaseSeeder extends Seeder $library = Library::create([ 'name' => 'Einundzwanzig', 'language_codes' => ['de'], + 'created_by' => 1, ]); $libraryItem = LibraryItem::create([ 'lecturer_id' => 3, @@ -241,6 +262,7 @@ class DatabaseSeeder extends Seeder 'type' => 'youtube_video', 'language_code' => 'de', 'value' => 'https://www.youtube.com/watch?v=Oztd2Sja4k0', + 'created_by' => 1, ]); $libraryItem->syncTagsWithType(['Bitcoin'], 'library_item'); $library->libraryItems() @@ -248,6 +270,7 @@ class DatabaseSeeder extends Seeder $library = Library::create([ 'name' => 'Apricot', 'language_codes' => ['de', 'en'], + 'created_by' => 1, ]); $libraryItem = LibraryItem::create([ 'lecturer_id' => 4, @@ -255,6 +278,7 @@ class DatabaseSeeder extends Seeder 'type' => 'blog_article', 'language_code' => 'de', 'value' => 'https://aprycot.media/blog/liebe-krypto-und-fiat-bros/', + 'created_by' => 1, ]); $libraryItem->syncTagsWithType(['Bitcoin'], 'library_item'); $library->libraryItems() @@ -262,6 +286,7 @@ class DatabaseSeeder extends Seeder $library = Library::create([ 'name' => 'Gigi', 'language_codes' => ['de', 'en'], + 'created_by' => 1, ]); $libraryItem = LibraryItem::create([ 'lecturer_id' => 4, @@ -269,6 +294,7 @@ class DatabaseSeeder extends Seeder 'type' => 'youtube_video', 'language_code' => 'de', 'value' => 'https://www.youtube.com/watch?v=C7ynm0Zkwfk', + 'created_by' => 1, ]); $libraryItem->syncTagsWithType(['Proof of Work'], 'library_item'); $library->libraryItems() @@ -277,6 +303,7 @@ class DatabaseSeeder extends Seeder 'name' => 'Einundzwanzig Dozenten', 'is_public' => false, 'language_codes' => ['de', 'en'], + 'created_by' => 1, ]); $libraryItem = LibraryItem::create([ 'lecturer_id' => 4, @@ -284,6 +311,7 @@ class DatabaseSeeder extends Seeder 'type' => 'downloadable_file', 'language_code' => 'de', 'value' => null, + 'created_by' => 1, ]); $libraryItem->syncTagsWithType(['Präsentationen'], 'library_item'); $nonPublicLibrary->libraryItems() @@ -294,6 +322,7 @@ class DatabaseSeeder extends Seeder 'city_id' => 1, 'name' => 'Einundzwanzig Kempten', 'link' => 'https://t.me/EinundzwanzigKempten', + 'created_by' => 1, ]); MeetupEvent::create([ 'meetup_id' => 1, @@ -304,6 +333,7 @@ class DatabaseSeeder extends Seeder 'location' => 'Einundzwanzig Kempten', 'description' => fake()->text(), 'link' => 'https://t.me/EinundzwanzigKempten', + 'created_by' => 1, ]); BitcoinEvent::create([ 'venue_id' => 4, @@ -321,6 +351,7 @@ Advance ticket sales begin on December 21, 2022 at 9:21 p.m. with time-limited e Ticket presale begins on December 21, 2022 at 9:21 p.m. Be quick - there are a limited amount of early bird tickets again. ', 'link' => 'https://bconf.de/en/', + 'created_by' => 1, ]); } } diff --git a/draft.yaml b/draft.yaml index e69de29b..0d6e5034 100644 --- a/draft.yaml +++ b/draft.yaml @@ -0,0 +1,4 @@ +models: + Item: + name: string:unique + link: string