mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
set timezone
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Date;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Stringable;
|
||||
@@ -10,22 +12,22 @@ class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
Date::use(
|
||||
Carbon::class
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
Stringable::macro('initials', function(){
|
||||
Stringable::macro('initials', function () {
|
||||
$words = preg_split("/\s+/", $this);
|
||||
$initials = "";
|
||||
|
||||
@@ -35,7 +37,7 @@ class AppServiceProvider extends ServiceProvider
|
||||
|
||||
return new static($initials);
|
||||
});
|
||||
Str::macro('initials', function(string $string){
|
||||
Str::macro('initials', function (string $string) {
|
||||
return (string) (new Stringable($string))->initials();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Observers\EventObserver;
|
||||
use Illuminate\Auth\Events\Registered;
|
||||
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||
@@ -27,7 +28,7 @@ class EventServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
//
|
||||
\App\Models\Event::observe(EventObserver::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -82,6 +82,10 @@ class NovaServiceProvider extends NovaApplicationServiceProvider
|
||||
// return MIT license and date
|
||||
return sprintf("%s %s - %s", date('Y'), config('app.name'), __('MIT License'));
|
||||
});
|
||||
|
||||
Nova::userTimezone(function (Request $request) {
|
||||
return $request->user()->timezone;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user