mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-13 06:56:48 +00:00
podcasts added
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Feed;
|
||||
|
||||
use App\Models\Episode;
|
||||
use App\Models\Podcast;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class ReadAndSyncEinundzwanzigPodcastFeed extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'feed:sync';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Command description';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$client = new \PodcastIndex\Client([
|
||||
'app' => 'Einundzwanzig School',
|
||||
'key' => config('feeds.services.podcastindex-org.key'),
|
||||
'secret' => config('feeds.services.podcastindex-org.secret'),
|
||||
]);
|
||||
$podcast = $client->podcasts->byFeedUrl('https://einundzwanzig.space/feed.xml')
|
||||
->json();
|
||||
$einundzwanzigPodcast = Podcast::query()
|
||||
->updateOrCreate(['guid' => $podcast->feed->podcastGuid], [
|
||||
'title' => $podcast->feed->title,
|
||||
'link' => $podcast->feed->link,
|
||||
'language_code' => $podcast->feed->language,
|
||||
'data' => $podcast->feed,
|
||||
]);
|
||||
$episodes = $client->episodes->byFeedUrl('https://einundzwanzig.space/feed.xml')
|
||||
->json();
|
||||
foreach ($episodes->items as $item) {
|
||||
Episode::query()
|
||||
->updateOrCreate(['guid' => $item->guid], [
|
||||
'podcast_id' => $einundzwanzigPodcast->id,
|
||||
'data' => $item,
|
||||
]);
|
||||
}
|
||||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Http\Livewire\Frontend;
|
||||
|
||||
use App\Models\Country;
|
||||
use App\Models\Podcast;
|
||||
use Livewire\Component;
|
||||
|
||||
class Library extends Component
|
||||
@@ -24,13 +25,22 @@ class Library extends Component
|
||||
abort(403);
|
||||
}
|
||||
|
||||
$libraries = \App\Models\Library::query()
|
||||
->where('is_public', $shouldBePublic)
|
||||
->get();
|
||||
$tabs = collect([
|
||||
[
|
||||
'name' => 'Alle',
|
||||
]
|
||||
]);
|
||||
foreach ($libraries as $library) {
|
||||
$tabs->push([
|
||||
'name' => $library->name,
|
||||
]);
|
||||
}
|
||||
|
||||
return view('livewire.frontend.library', [
|
||||
'libraries' => \App\Models\Library::query()
|
||||
->where('is_public', $shouldBePublic)
|
||||
->get()
|
||||
->prepend(\App\Models\Library::make([
|
||||
'name' => 'Alle',
|
||||
])),
|
||||
'libraries' => $tabs,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ class LibraryItemTable extends DataTableComponent
|
||||
'alt' => $row->name.' Avatar',
|
||||
])
|
||||
->collapseOnMobile(),
|
||||
Column::make('Dozent', "lecturer.name")
|
||||
Column::make('Ersteller', "lecturer.name")
|
||||
->label(
|
||||
fn($row, Column $column) => view('columns.courses.lecturer')->withRow($row)
|
||||
)
|
||||
|
||||
40
app/Models/Episode.php
Normal file
40
app/Models/Episode.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
use Spatie\Tags\HasTags;
|
||||
|
||||
class Episode extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use HasTags;
|
||||
|
||||
/**
|
||||
* 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',
|
||||
'podcast_id' => 'integer',
|
||||
'data' => 'array',
|
||||
];
|
||||
|
||||
public function podcast(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Podcast::class);
|
||||
}
|
||||
|
||||
public function libraryItem(): HasOne
|
||||
{
|
||||
return $this->hasOne(LibraryItem::class);
|
||||
}
|
||||
}
|
||||
@@ -64,6 +64,11 @@ class LibraryItem extends Model implements HasMedia, Sortable
|
||||
return $this->belongsTo(Lecturer::class);
|
||||
}
|
||||
|
||||
public function episode(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Episode::class);
|
||||
}
|
||||
|
||||
public function libraries(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Library::class);
|
||||
|
||||
32
app/Models/Podcast.php
Normal file
32
app/Models/Podcast.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class Podcast extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* 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',
|
||||
'data' => 'array',
|
||||
];
|
||||
|
||||
public function episodes(): HasMany
|
||||
{
|
||||
return $this->hasMany(Episode::class);
|
||||
}
|
||||
}
|
||||
@@ -13,4 +13,9 @@ class Tag extends \Spatie\Tags\Tag
|
||||
{
|
||||
return $this->morphedByMany(LibraryItem::class, 'taggable');
|
||||
}
|
||||
|
||||
public function episodes()
|
||||
{
|
||||
return $this->morphedByMany(Episode::class, 'taggable');
|
||||
}
|
||||
}
|
||||
|
||||
156
app/Nova/Episode.php
Normal file
156
app/Nova/Episode.php
Normal file
@@ -0,0 +1,156 @@
|
||||
<?php
|
||||
|
||||
namespace App\Nova;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Http\Request;
|
||||
use Laravel\Nova\Fields\Avatar;
|
||||
use Laravel\Nova\Fields\BelongsTo;
|
||||
use Laravel\Nova\Fields\Code;
|
||||
use Laravel\Nova\Fields\ID;
|
||||
use Laravel\Nova\Fields\Text;
|
||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||
use Spatie\TagsField\Tags;
|
||||
|
||||
class Episode extends Resource
|
||||
{
|
||||
/**
|
||||
* The model the resource corresponds to.
|
||||
* @var string
|
||||
*/
|
||||
public static $model = \App\Models\Episode::class;
|
||||
/**
|
||||
* The columns that should be searched.
|
||||
* @var array
|
||||
*/
|
||||
public static $search = [
|
||||
'id',
|
||||
];
|
||||
|
||||
public static function afterUpdate(NovaRequest $request, Model $model)
|
||||
{
|
||||
if ($request->tags) {
|
||||
$lecturer = \App\Models\Lecturer::updateOrCreate(['name' => $model->podcast->title], [
|
||||
'team_id' => 1,
|
||||
'active' => true,
|
||||
]);
|
||||
$lecturer->addMediaFromUrl($model->podcast->data['image'])
|
||||
->toMediaCollection('avatar');
|
||||
$library = \App\Models\Library::updateOrCreate(
|
||||
[
|
||||
'name' => $model->podcast->title
|
||||
],
|
||||
[
|
||||
'language_codes' => [$model->podcast->language_code],
|
||||
]);
|
||||
$libraryItem = $model->libraryItem()
|
||||
->firstOrCreate([
|
||||
'lecturer_id' => $lecturer->id,
|
||||
'episode_id' => $model->id,
|
||||
'name' => $model->data['title'],
|
||||
'type' => 'podcast_episode',
|
||||
'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'])
|
||||
->toMediaCollection('main');
|
||||
$library->libraryItems()
|
||||
->attach($libraryItem);
|
||||
}
|
||||
}
|
||||
|
||||
public function title()
|
||||
{
|
||||
return $this->data['title'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the fields displayed by the resource.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function fields(Request $request)
|
||||
{
|
||||
return [
|
||||
ID::make()
|
||||
->sortable(),
|
||||
|
||||
Avatar::make('Image')
|
||||
->squared()
|
||||
->thumbnail(function () {
|
||||
return $this->data['image'];
|
||||
})
|
||||
->exceptOnForms(),
|
||||
|
||||
Tags::make('Tags')
|
||||
->type('library_item')
|
||||
->withLinkToTagResource(Tag::class),
|
||||
|
||||
Text::make('Title', 'data->title')
|
||||
->readonly()
|
||||
->rules('required', 'string'),
|
||||
|
||||
Code::make('Data')
|
||||
->readonly()
|
||||
->rules('required', 'json')
|
||||
->json(),
|
||||
|
||||
BelongsTo::make('Podcast')
|
||||
->readonly(),
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the cards available for the request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function cards(Request $request)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the filters available for the resource.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function filters(Request $request)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the lenses available for the resource.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function lenses(Request $request)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the actions available for the resource.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function actions(Request $request)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -80,6 +80,7 @@ class LibraryItem extends Resource
|
||||
'markdown_article' => 'markdown_article',
|
||||
'youtube_video' => 'youtube_video',
|
||||
'vimeo_video' => 'vimeo_video',
|
||||
'podcast_episode' => 'podcast_episode',
|
||||
'downloadable_file' => 'downloadable_file',
|
||||
]
|
||||
)
|
||||
@@ -91,6 +92,8 @@ class LibraryItem extends Resource
|
||||
|
||||
BelongsTo::make('Lecturer'),
|
||||
|
||||
BelongsTo::make('Episode'),
|
||||
|
||||
BelongsToMany::make('Library', 'libraries', Library::class),
|
||||
|
||||
];
|
||||
|
||||
118
app/Nova/Podcast.php
Normal file
118
app/Nova/Podcast.php
Normal file
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
namespace App\Nova;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Laravel\Nova\Fields\Avatar;
|
||||
use Laravel\Nova\Fields\Code;
|
||||
use Laravel\Nova\Fields\HasMany;
|
||||
use Laravel\Nova\Fields\ID;
|
||||
use Laravel\Nova\Fields\Text;
|
||||
|
||||
class Podcast extends Resource
|
||||
{
|
||||
/**
|
||||
* The model the resource corresponds to.
|
||||
* @var string
|
||||
*/
|
||||
public static $model = \App\Models\Podcast::class;
|
||||
|
||||
/**
|
||||
* The single value that should be used to represent the resource when being displayed.
|
||||
* @var string
|
||||
*/
|
||||
public static $title = 'title';
|
||||
|
||||
/**
|
||||
* The columns that should be searched.
|
||||
* @var array
|
||||
*/
|
||||
public static $search = [
|
||||
'id',
|
||||
'title',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the fields displayed by the resource.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function fields(Request $request)
|
||||
{
|
||||
return [
|
||||
ID::make()
|
||||
->sortable(),
|
||||
|
||||
Avatar::make('Image')
|
||||
->squared()
|
||||
->thumbnail(function () {
|
||||
return $this->data['image'];
|
||||
}),
|
||||
|
||||
Text::make('Title')
|
||||
->rules('required', 'string'),
|
||||
|
||||
Text::make('Language Code')
|
||||
->rules('required', 'string'),
|
||||
|
||||
Text::make('Link')
|
||||
->rules('required', 'string'),
|
||||
|
||||
Code::make('Data')
|
||||
->rules('required', 'json')
|
||||
->json(),
|
||||
|
||||
HasMany::make('Episodes'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the cards available for the request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function cards(Request $request)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the filters available for the resource.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function filters(Request $request)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the lenses available for the resource.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function lenses(Request $request)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the actions available for the resource.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function actions(Request $request)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
68
app/Observers/EpisodeObserver.php
Normal file
68
app/Observers/EpisodeObserver.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Observers;
|
||||
|
||||
use App\Models\Episode;
|
||||
|
||||
class EpisodeObserver
|
||||
{
|
||||
/**
|
||||
* Handle the Episode "created" event.
|
||||
*
|
||||
* @param \App\Models\Episode $episode
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function created(Episode $episode)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the Episode "updated" event.
|
||||
*
|
||||
* @param \App\Models\Episode $episode
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function updated(Episode $episode)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the Episode "deleted" event.
|
||||
*
|
||||
* @param \App\Models\Episode $episode
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function deleted(Episode $episode)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the Episode "restored" event.
|
||||
*
|
||||
* @param \App\Models\Episode $episode
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function restored(Episode $episode)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the Episode "force deleted" event.
|
||||
*
|
||||
* @param \App\Models\Episode $episode
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function forceDeleted(Episode $episode)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
101
app/Policies/EpisodePolicy.php
Normal file
101
app/Policies/EpisodePolicy.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Models\Episode;
|
||||
use App\Models\User;
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
|
||||
class EpisodePolicy extends BasePolicy
|
||||
{
|
||||
use HandlesAuthorization;
|
||||
|
||||
/**
|
||||
* Determine whether the user can view any models.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
*
|
||||
* @return \Illuminate\Auth\Access\Response|bool
|
||||
*/
|
||||
public function viewAny(User $user)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @param \App\Models\Episode $episode
|
||||
*
|
||||
* @return \Illuminate\Auth\Access\Response|bool
|
||||
*/
|
||||
public function view(User $user, Episode $episode)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
*
|
||||
* @return \Illuminate\Auth\Access\Response|bool
|
||||
*/
|
||||
public function create(User $user)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @param \App\Models\Episode $episode
|
||||
*
|
||||
* @return \Illuminate\Auth\Access\Response|bool
|
||||
*/
|
||||
public function update(User $user, Episode $episode)
|
||||
{
|
||||
return $user->hasRole('super-admin');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @param \App\Models\Episode $episode
|
||||
*
|
||||
* @return \Illuminate\Auth\Access\Response|bool
|
||||
*/
|
||||
public function delete(User $user, Episode $episode)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore the model.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @param \App\Models\Episode $episode
|
||||
*
|
||||
* @return \Illuminate\Auth\Access\Response|bool
|
||||
*/
|
||||
public function restore(User $user, Episode $episode)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete the model.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @param \App\Models\Episode $episode
|
||||
*
|
||||
* @return \Illuminate\Auth\Access\Response|bool
|
||||
*/
|
||||
public function forceDelete(User $user, Episode $episode)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
94
app/Policies/PodcastPolicy.php
Normal file
94
app/Policies/PodcastPolicy.php
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Models\Podcast;
|
||||
use App\Models\User;
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
|
||||
class PodcastPolicy
|
||||
{
|
||||
use HandlesAuthorization;
|
||||
|
||||
/**
|
||||
* Determine whether the user can view any models.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @return \Illuminate\Auth\Access\Response|bool
|
||||
*/
|
||||
public function viewAny(User $user)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @param \App\Models\Podcast $podcast
|
||||
* @return \Illuminate\Auth\Access\Response|bool
|
||||
*/
|
||||
public function view(User $user, Podcast $podcast)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @return \Illuminate\Auth\Access\Response|bool
|
||||
*/
|
||||
public function create(User $user)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @param \App\Models\Podcast $podcast
|
||||
* @return \Illuminate\Auth\Access\Response|bool
|
||||
*/
|
||||
public function update(User $user, Podcast $podcast)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @param \App\Models\Podcast $podcast
|
||||
* @return \Illuminate\Auth\Access\Response|bool
|
||||
*/
|
||||
public function delete(User $user, Podcast $podcast)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore the model.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @param \App\Models\Podcast $podcast
|
||||
* @return \Illuminate\Auth\Access\Response|bool
|
||||
*/
|
||||
public function restore(User $user, Podcast $podcast)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete the model.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @param \App\Models\Podcast $podcast
|
||||
* @return \Illuminate\Auth\Access\Response|bool
|
||||
*/
|
||||
public function forceDelete(User $user, Podcast $podcast)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Models\Episode;
|
||||
use App\Observers\EpisodeObserver;
|
||||
use App\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Date;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
@@ -2,17 +2,15 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Observers\EventObserver;
|
||||
use App\Observers\EpisodeObserver;
|
||||
use Illuminate\Auth\Events\Registered;
|
||||
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The event to listener mappings for the application.
|
||||
*
|
||||
* @var array<class-string, array<int, class-string>>
|
||||
*/
|
||||
protected $listen = [
|
||||
@@ -23,17 +21,15 @@ class EventServiceProvider extends ServiceProvider
|
||||
|
||||
/**
|
||||
* Register any events for your application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
\App\Models\Event::observe(EventObserver::class);
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if events and listeners should be automatically discovered.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function shouldDiscoverEvents()
|
||||
|
||||
@@ -7,11 +7,13 @@ use App\Nova\City;
|
||||
use App\Nova\Country;
|
||||
use App\Nova\Course;
|
||||
use App\Nova\Dashboards\Main;
|
||||
use App\Nova\Episode;
|
||||
use App\Nova\Event;
|
||||
use App\Nova\Lecturer;
|
||||
use App\Nova\Library;
|
||||
use App\Nova\LibraryItem;
|
||||
use App\Nova\Participant;
|
||||
use App\Nova\Podcast;
|
||||
use App\Nova\Registration;
|
||||
use App\Nova\Tag;
|
||||
use App\Nova\Team;
|
||||
@@ -59,6 +61,13 @@ class NovaServiceProvider extends NovaApplicationServiceProvider
|
||||
->icon('library')
|
||||
->collapsable(),
|
||||
|
||||
MenuSection::make('Podcasts', [
|
||||
MenuItem::resource(Podcast::class),
|
||||
MenuItem::resource(Episode::class),
|
||||
])
|
||||
->icon('microphone')
|
||||
->collapsable(),
|
||||
|
||||
MenuSection::make('Admin', [
|
||||
MenuItem::resource(Category::class),
|
||||
MenuItem::resource(Country::class),
|
||||
|
||||
Reference in New Issue
Block a user