Comments (4)
Hey there, thanks for reporting this issue.
We'll need more info and/or code to debug this further. Can you please create a repository with the command below, commit the code that reproduces the issue as one separate commit on the main/master branch and share the repository here?
Please make sure that you have the latest version of the Laravel installer in order to run this command. Please also make sure you have both Git & the GitHub CLI tool properly set up.
laravel new bug-report --github="--public"
Do not amend and create a separate commit with your custom changes. After you've posted the repository, we'll try to reproduce the issue.
Thanks!
from framework.
It might be challenging to reproduce this bug, but I can add you as a contributor to the project so you can examine the issue.
from framework.
`Route::prefix("School")->group(function () {
Route::get('get_bills_for_school', [intel::class, 'get_bills_for_school'])->name('get_bills_for_school');
});`
` public function get_bills_for_school()
{
try {
if (Auth::user()) {
return Auth::user();
} else {
return response()->json([
"status" => false,
"message" => "User not found",
]);
}
$bills_data = tblbills::where('sch_code', Auth::user()->schoolCode);
return response()->json([
"status" => true,
"data" => ResourceBills::collection($bills_data),
]);
} catch (\Throwable $th) {
//throw $th;
return response()->json([
"status" => false,
"system" => true,
"message" => 'Error: ' . $th->getMessage(),
], 500);
}
}` After authentication, some methods in a controller can successfully retrieve the authenticated user using Auth::user(), while other methods in the same controller cannot. This phenomenon is quite strange. For Example this is the responds i get from this method `{
"status": false,
"message": "User not found"
}` I have encountered this problem multiple times in the past.
from framework.
@mawuli-agbenyo-creator
Have you added the Auth
middleware in routes? As it did not available in your last comment where you added the Route definition. So, I am confirming.
from framework.
Related Issues (20)
- [11.9.0] Event appears to be fired twice in test HOT 1
- Reopening: Queue priorities & block_for shouldn't be used together HOT 5
- BelongsToMany relation withoutGlobalScope() is not being applied HOT 1
- Out of memory when sending large disk attachments HOT 5
- Str::snake doesn't handle multibyte uppercase letters HOT 1
- New error renderer is broken HOT 2
- Broadcast::auth($request); gives error in pusher HOT 1
- Optional route parameters doesn't work correctly. HOT 5
- Some events are listed and called twice since v11.9.2 HOT 3
- import.meta.env.VITE_APP_NAME and process.env.VITE_APP_NAME not working in vite.config.js HOT 1
- Difficulty Running Interactive Artisan Commands from Laravel Migrations
- Laravel 10 and Symfony 6 setDispatcher() function being provided wrong type HOT 2
- Team Update HOT 1
- The Route::dispatch method cannot pass parameters to the called controller. HOT 2
- Unexpected `value()` method behavior when querying Eloquent models. HOT 1
- Cache::forget not remove cached data with redis HOT 3
- once() usage with static methods HOT 6
- RefreshDatabaseTrait is not refreshing all database connections HOT 3
- Hoisted variable in template HOT 1
- Str::kebab Does Not Convert snake_case to kebab-case Correctly. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from framework.