Move micropub session stuff to its own service provider
This commit is contained in:
parent
cd324f72d5
commit
e32cc59b81
3 changed files with 36 additions and 9 deletions
|
@ -5,7 +5,6 @@ namespace App\Providers;
|
|||
use App\Tag;
|
||||
use App\Note;
|
||||
use Validator;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
|
@ -46,14 +45,6 @@ class AppServiceProvider extends ServiceProvider
|
|||
$note->tags()->attach($tagsToAdd);
|
||||
}
|
||||
});
|
||||
|
||||
//allow micropub use in development
|
||||
if (env('APP_DEBUG') == true || env('APP_ENV') == 'testing') {
|
||||
session(['me' => env('APP_URL')]);
|
||||
if (Storage::exists('dev-token')) {
|
||||
session(['token' => Storage::get('dev-token')]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
35
app/Providers/MicropubSessionProvider.php
Normal file
35
app/Providers/MicropubSessionProvider.php
Normal file
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class MicropubSessionProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap the application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
//allow micropub use in development
|
||||
if (env('APP_DEBUG') == true) {
|
||||
session(['me' => env('APP_URL')]);
|
||||
if (Storage::exists('dev-token')) {
|
||||
session(['token' => Storage::get('dev-token')]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
|
@ -182,6 +182,7 @@ return [
|
|||
// App\Providers\BroadcastServiceProvider::class,
|
||||
App\Providers\EventServiceProvider::class,
|
||||
App\Providers\RouteServiceProvider::class,
|
||||
App\Providers\MicropubSessionProvider::class,
|
||||
|
||||
/*
|
||||
* Laravel Debugbar
|
||||
|
|
Loading…
Add table
Reference in a new issue