Skip to content

Commit

Permalink
Fix menu on Octane (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mystical0628 authored Sep 5, 2024
1 parent 2dcd035 commit 020f062
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 68 deletions.
11 changes: 8 additions & 3 deletions src/CrudServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Illuminate\Support\ServiceProvider;
use Orchid\Crud\Commands\ActionCommand;
use Orchid\Crud\Commands\ResourceCommand;
use Orchid\Crud\Middleware\BootCrudGenerator;
use Orchid\Platform\Providers\FoundationServiceProvider;
use Orchid\Support\Facades\Dashboard;

Expand Down Expand Up @@ -34,9 +33,15 @@ class CrudServiceProvider extends ServiceProvider
*
* @return void
*/
public function boot()
public function boot(ResourceFinder $finder, Arbitrator $arbitrator)
{
Route::pushMiddlewareToGroup('platform', BootCrudGenerator::class);
$resources = $finder
->setNamespace(app()->getNamespace() . 'Orchid\\Resources')
->find(app_path('Orchid/Resources'));

$arbitrator
->resources($resources)
->boot();

Route::domain((string)config('platform.domain'))
->prefix(Dashboard::prefix('/'))
Expand Down
52 changes: 0 additions & 52 deletions src/Middleware/BootCrudGenerator.php

This file was deleted.

11 changes: 0 additions & 11 deletions tests/ProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,9 @@

use Illuminate\Support\Facades\Route;
use Illuminate\Support\Str;
use Orchid\Crud\Middleware\BootCrudGenerator;

class ProviderTest extends TestCase
{
public function testMiddlewareRegister(): void
{
$this->assertTrue(Route::hasMiddlewareGroup('platform'));

$this->assertContains(
BootCrudGenerator::class,
Route::getMiddlewareGroups()['platform']
);
}

public function testRouteRegister(): void
{
$this->assertTrue(Route::has('platform.resource.create'));
Expand Down
3 changes: 1 addition & 2 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Orchestra\Testbench\TestCase as Orchestra;
use Orchid\Crud\Arbitrator;
use Orchid\Crud\CrudServiceProvider;
use Orchid\Crud\Middleware\BootCrudGenerator;
use Orchid\Crud\ResourceFinder;
use Orchid\Platform\Providers\FoundationServiceProvider;
use Orchid\Platform\Providers\RouteServiceProvider;
Expand Down Expand Up @@ -64,7 +63,7 @@ public function getEnvironmentSetUp($app)
{
$app['config']->set('platform.auth', false);
$app['config']->set('platform.middleware.public', ['web']);
$app['config']->set('platform.middleware.private', ['web', BootCrudGenerator::class]);
$app['config']->set('platform.middleware.private', ['web']);

$app['config']->set('database.default', 'sqlite');
$app['config']->set('database.connections.sqlite', [
Expand Down

0 comments on commit 020f062

Please sign in to comment.