Answer the question
In order to leave comments, you need to log in
Is there a method in Laravel collection that checks if it is empty?
It is necessary to make such logic that the user can send a request once a day, this works if the user already has requests, and if there are no requests, then the error
is the code, I don’t understand how to check that there is nothing in the collection.
@if(auth()->user()->manager)
<a href="requests/view">Show reuqests</a>
@else
@if(auth()->user()->requests()->latest()->first()->created_at->timestamp - now()->timestamp > 86400)
<a href="/requests/create">You can Send a request</a>
@else
<p>You already sent a request today, comeback tomorrow</p>
@endif
@endif
Trying to get property 'created_at' of non-object (View: C:\xampp\htdocs\Callback\resources\views\userWelcome.blade.php)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question