MOTOSHARE 🚗🏍️
Turning Idle Vehicles into Shared Rides & Earnings

From Idle to Income. From Parked to Purpose.
Earn by Sharing, Ride by Renting.
Where Owners Earn, Riders Move.
Owners Earn. Riders Move. Motoshare Connects.

With Motoshare, every parked vehicle finds a purpose. Owners earn. Renters ride.
🚀 Everyone wins.

Start Your Journey with Motoshare

Auth::check() at middleware

error

!Auth::check() in the middleware to check if user is logged in or not, i am trying to get property of non-object but it shows an error like below: at => /Http/Middleware/VerifyCsrfToken.php $response->headers->setCookie

 admin middleware:

public function handle($request, Closure $next) { if (!Auth::check()) { return “Permission Denied.”; } return $next($request); }

Solution:

The error is encountering, “trying to get property of non-object,” suggests that the $response variable in the middleware is not an object as expected. To resolve this issue, you need to return an instance of a response object instead of a string. Here’s an updated version of your code:

Instead of returning a string, the middleware should return an instance of a response object. To achieve this, please consider the following approach:

public function handle($request, Closure $next) { if (!Auth::check()) { return response(‘Permission Denied.’, 401); } return $next($request); }

Related Posts

Ace the EX280: Your Key to Mastering Red Hat OpenShift

In today’s fast-paced tech landscape, container orchestration with Kubernetes is a must-have skill. But for enterprise environments, you need a platform that is robust, secure, and scalable….

Master Ansible Automation: Your Complete Guide to Red Hat EX407 Certification

In today’s lightning-fast IT world, manual server configurations are a thing of the past. Enter Ansible—the agentless powerhouse that’s transforming how teams manage infrastructure. If you’re a…

The Quantum Advantage: Unlocking Your Potential

Imagine a computer that doesn’t think in simple ones and zeros but explores all possibilities simultaneously. This isn’t science fiction; it’s the reality of Quantum Computing, and…

Master Python & Machine Learning in 20 Hours

In the whirlwind of today’s tech industry, where AI and data analytics are reshaping everything from healthcare to finance, Python stands tall as the go-to language for…

Advance Your DevOps Career with Prometheus and Grafana Skills

In today’s fast-paced DevOps environment, system monitoring and real-time data visualization have become vital to ensuring the performance and reliability of applications. Among the leading tools trusted…

Master Observability: Prometheus and Grafana Certification at DevOpsSchool

As modern systems evolve into microservices and distributed architectures, businesses of all scales seek reliable solutions for monitoring and visualization. Among today’s most critical skills for DevOps,…

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x