generated from spatie/package-skeleton-laravel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8c36f06
commit b8e2bc5
Showing
17 changed files
with
385 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace ArtisanBuild\Docsidian\Database\Factories; | ||
|
||
use ArtisanBuild\Docsidian\Models\DocsidianSite; | ||
use Illuminate\Database\Eloquent\Factories\Factory; | ||
|
||
|
||
class DocsidianSiteFactory extends Factory | ||
{ | ||
protected $model = DocsidianSite::class; | ||
|
||
public function definition() | ||
{ | ||
return [ | ||
|
||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
|
||
namespace ArtisanBuild\Docsidian\Commands; | ||
|
||
use ArtisanBuild\Docsidian\Models\DocsidianSite; | ||
use ArtisanBuild\Docsidian\SiteStatus; | ||
use Illuminate\Console\Command; | ||
use Illuminate\Support\Facades\File; | ||
use Illuminate\Support\Str; | ||
|
||
class DiscoverCommand extends Command | ||
{ | ||
public $signature = 'docsidian:discover {directory?}'; | ||
public $description = 'Create a record for every folder in the markdown folder'; | ||
|
||
public function handle(): int | ||
{ | ||
$directories = File::directories($this->argument('directory') ?? config('docsidian.md_path')); | ||
|
||
foreach ($directories as $directory) { | ||
if (DocsidianSite::where('md_path', $directory)->exists()) { | ||
continue; | ||
} | ||
$key = last(explode(DIRECTORY_SEPARATOR, $directory)); | ||
$site = DocsidianSite::create([ | ||
'name' => $this->generateName($key), | ||
'description' => null, | ||
'image' => null, | ||
'weight' => (DocsidianSite::max('weight') ?? 0) + 100, | ||
'status' => SiteStatus::Hidden, | ||
'default_visibility' => config('docsidian.default_visibility'), | ||
'folio_middleware' => config('docsidian.folio_middleware'), | ||
'folio_path' => implode(DIRECTORY_SEPARATOR, [config('docsidian.folio_path'), $key]), | ||
'folio_uri' => implode('/', [config('docsidian.folio_uri'), $key]), | ||
'layout' => config('docsidian.layout'), | ||
'md_path' => $directory, | ||
'obsidian_config' => config('docsidian.obsidian_config'), | ||
|
||
]); | ||
|
||
File::ensureDirectoryExists($site->folio_path); | ||
|
||
$this->info("Created record for {$key}"); | ||
} | ||
return self::SUCCESS; | ||
} | ||
|
||
public function generateName(string $key): string | ||
{ | ||
if (str_contains('.', $key)) { | ||
return $key; | ||
} | ||
|
||
return Str::headline($key); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
|
||
namespace ArtisanBuild\Docsidian; | ||
|
||
use Filament\Http\Middleware\Authenticate; | ||
use Filament\Http\Middleware\DisableBladeIconComponents; | ||
use Filament\Http\Middleware\DispatchServingFilamentEvent; | ||
use Filament\Pages; | ||
use Filament\Panel; | ||
use Filament\PanelProvider; | ||
use Filament\Support\Colors\Color; | ||
use Filament\Widgets; | ||
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse; | ||
use Illuminate\Cookie\Middleware\EncryptCookies; | ||
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken; | ||
use Illuminate\Routing\Middleware\SubstituteBindings; | ||
use Illuminate\Session\Middleware\AuthenticateSession; | ||
use Illuminate\Session\Middleware\StartSession; | ||
use Illuminate\View\Middleware\ShareErrorsFromSession; | ||
|
||
class DocumentationPanelProvider extends PanelProvider | ||
{ | ||
public function panel(Panel $panel): Panel | ||
{ | ||
return $panel | ||
->default() | ||
->id('docsidian') | ||
->path('docsidian') | ||
->login() | ||
->colors([ | ||
'primary' => Color::Amber, | ||
]) | ||
->discoverResources(in: __DIR__.'/Filament', for: 'ArtisanBuild\\Docsidian\\Filament') | ||
->discoverPages(in: __DIR__.'Filament/Pages', for: 'ArtisanBuild\\Docsidian\\Filament\\Pages') | ||
->pages([ | ||
Pages\Dashboard::class, | ||
Pages\Dashboard::class, | ||
]) | ||
->discoverWidgets(in: __DIR__.'Filament/Widgets', for: 'ArtisanBuild\\Docsidian\\Filament\\Widgets') | ||
->widgets([ | ||
Widgets\AccountWidget::class, | ||
Widgets\FilamentInfoWidget::class, | ||
]) | ||
->middleware([ | ||
EncryptCookies::class, | ||
AddQueuedCookiesToResponse::class, | ||
StartSession::class, | ||
AuthenticateSession::class, | ||
ShareErrorsFromSession::class, | ||
VerifyCsrfToken::class, | ||
SubstituteBindings::class, | ||
DisableBladeIconComponents::class, | ||
DispatchServingFilamentEvent::class, | ||
]) | ||
->authMiddleware([ | ||
Authenticate::class, | ||
]); | ||
|
||
} | ||
} |
Oops, something went wrong.