Closed Reddishye closed 3 months ago
I just did a fresh Laravel 11 install and then installed this package and all worked fine. I wonder if you have another package installed that could be conflicting with it? I'd suggest trying to narrow down the culprit by removing packages and slowly adding them in one by one if possible?
Im using Laravel Jetstream (Livewire) and this is my composer.json:
{ "name": "laravel/laravel", "type": "project", "description": "The skeleton application for the Laravel framework.", "keywords": [ "laravel", "framework" ], "license": "MIT", "require": { "php": "^8.2", "filament/forms": "^3.2", "inertiajs/inertia-laravel": "^1.0", "laravel/framework": "^11.0", "laravel/jetstream": "^5.0", "laravel/sanctum": "^4.0", "laravel/tinker": "^2.9", "livewire/livewire": "^3.0", "tightenco/ziggy": "^2.0" }, "require-dev": { "fakerphp/faker": "^1.23", "laravel/pint": "^1.13", "laravel/sail": "^1.26", "mockery/mockery": "^1.6", "nunomaduro/collision": "^8.0", "phpunit/phpunit": "^11.0", "spatie/laravel-ignition": "^2.4" }, "autoload": { "psr-4": { "App\\": "app/", "Database\\Factories\\": "database/factories/", "Database\\Seeders\\": "database/seeders/" }, "files": [ "app/helpers.php" ] }, "autoload-dev": { "psr-4": { "Tests\\": "tests/" }, "files": [ "app/helpers.php" ] }, "scripts": { "post-autoload-dump": [ "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", "@php artisan package:discover --ansi", "@php artisan filament:upgrade" ], "post-update-cmd": [ "@php artisan vendor:publish --tag=laravel-assets --ansi --force" ], "post-root-package-install": [ "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" ], "post-create-project-cmd": [ "@php artisan key:generate --ansi", "@php -r \"file_exists('database/database.sqlite') || touch('database/database.sqlite');\"", "@php artisan migrate --graceful --ansi" ] }, "extra": { "laravel": { "dont-discover": [] } }, "config": { "optimize-autoloader": true, "preferred-install": "dist", "sort-packages": true, "allow-plugins": { "pestphp/pest-plugin": true, "php-http/discovery": true } }, "minimum-stability": "stable", "prefer-stable": true }
Actually removing package by package is not suitable as all packages are used on my application.
{
"name": "laravel/laravel",
"type": "project",
"description": "The skeleton application for the Laravel framework.",
"keywords": [
"laravel",
"framework"
],
"license": "MIT",
"require": {
"php": "^8.2",
"filament/forms": "^3.2",
"inertiajs/inertia-laravel": "^1.0",
"laravel/framework": "^11.0",
"laravel/jetstream": "^5.0",
"laravel/sanctum": "^4.0",
"laravel/tinker": "^2.9",
"livewire/livewire": "^3.0",
"tightenco/ziggy": "^2.0"
},
"require-dev": {
"fakerphp/faker": "^1.23",
"laravel/pint": "^1.13",
"laravel/sail": "^1.26",
"mockery/mockery": "^1.6",
"nunomaduro/collision": "^8.0",
"phpunit/phpunit": "^11.0",
"spatie/laravel-ignition": "^2.4"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
},
"files": [
"app/helpers.php"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
},
"files": [
"app/helpers.php"
]
},
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi",
"@php artisan filament:upgrade"
],
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi",
"@php -r \"file_exists('database/database.sqlite') || touch('database/database.sqlite');\"",
"@php artisan migrate --graceful --ansi"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true,
"php-http/discovery": true
}
},
"minimum-stability": "stable",
"prefer-stable": true
}
Seems like the issue is Laravel Jetstream, I'll look into it.
Hey @Reddishye, apologies for the delay. The new 2.0.0 version of the package should now work with Laravel 11.
Thanks for your patience.
Sorry for not responding, thank you for the fast fix ❤️
You're welcome, @Reddishye! Have a great weekend!
@andreaselia You too! I only had a doubt, is possible to use sanctum as auth middleware with jetstream config? smth like this:
<?php
use App\Http\Controllers\UserController;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\ProjectController;
use App\Http\Controllers\UserViewController;
use App\Http\Controllers\LinksManager;
use App\Http\Controllers\LinksViewer;
Route::get('/', [UserViewController::class, 'index'])->name('home');
Route::get('/links/{path?}', [LinksViewer::class, 'redirect'])->where('path', '.*')->name('links.redirect');
Route::redirect('/dashboard', '/admin/dashboard');
Route::prefix('admin')->middleware([
'auth:sanctum',
config('jetstream.auth_session'),
'verified',
])->group(function () {
Route::get('/dashboard', function () {
return view('dashboard');
})->name('dashboard');
Route::resource('projects', ProjectController::class);
Route::resource('links', LinksManager::class);
Route::resource('users', UserController::class);
});
I don't know what jetstream.auth_session
is, but you could do something like:
Route::prefix('admin')->middleware(array_merge([
'auth:sanctum',
'verified',
], config('jetstream.middleware')))->group(function () {
Yeah, I alredy saw, the solution was adding to middlewares auth:sanctum! Thanks!!