Skip to content
Advertisement

Laravel count Support Tickets from a user [closed]

I have this in the Dashboard Screenshot of the Dashboard

I want that it shows how many Tickets are open / closed / all

How do I do this with this Database?Screenshot from SELECT * FROM tickets

How do I do this that every user see his own open / closed and all tickets?

Advertisement

Answer

Inside your blade.php file you could do:

JavaScript

To use this you need to pass $tickets from your controller to your view. Here’s an example of what that might look:

JavaScript

What’s great about this solution is that you can display it the way you want using only 1 query:

JavaScript

Join some code next time 🙂

Update

If you are not passing any data to your view you can also use (where Ticket is your model name)

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement