Skip to content

Commit

Permalink
Merge pull request #4 from lucky-media/v1.2
Browse files Browse the repository at this point in the history
v1.2 Add Laravel Model Safety
  • Loading branch information
lokmanm authored Aug 20, 2023
2 parents b155d84 + 99d0c28 commit 8aab72f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Console/InstallsReactorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ protected function installInertiaReact()
$this->installMiddlewareAfter('SubstituteBindings::class', '\App\Http\Middleware\HandleInertiaRequests::class');
$this->installMiddlewareAfter('\App\Http\Middleware\HandleInertiaRequests::class', '\Illuminate\Http\Middleware\AddLinkHeadersForPreloadedAssets::class');

// Providers...
copy(__DIR__.'/../../stubs/inertia-react/app/Providers/AppServiceProvider.php', app_path('Providers/AppServiceProvider.php'));

copy(__DIR__.'/../../stubs/inertia-react/app/Http/Middleware/HandleInertiaRequests.php', app_path('Http/Middleware/HandleInertiaRequests.php'));

// Views...
Expand Down
27 changes: 27 additions & 0 deletions stubs/inertia-react/app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Database\Eloquent\Model;

class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
//
}

/**
* Bootstrap any application services.
*/
public function boot(): void
{
Model::preventLazyLoading(!$this->app->isProduction());
Model::preventAccessingMissingAttributes();
Model::preventSilentlyDiscardingAttributes();
}
}

0 comments on commit 8aab72f

Please sign in to comment.