Skip to content

PHPUnit assertDatabaseHas with Laravel and Inertia

I have a Laravel 8 setup that utilises Intertia.js. I’m trying to test my post routes to store new resources and want to assert that the database has the new record stored, using the assertDatabaseHas() method. Controller.php CreateSlotTest.php When I debug the session I can see the slot that I added to…

check expire time for each verification code

In the code below i check If there is a record for the user Check if ‍‍‍‍‍‍‍‍exprire_at is smaller than it is now, it will expire and create a new code, otherwise show the user a message. But in both cases a new code is created What is the problem Answer change to and to

Variable with counts are not working with larapex

I am using Larapex charts for my laravel project but I cannot make the chart render when using a variable that contains my values retrieved from the database. The variable above retrives following values: Which I then try to place within the chart But unfortunately the chart does not render the values. Can an…

How to add values from an XML file to a csv file in php?

I have a link to an online XML file that contains different values. I have written a code that allows me to retrieve the contents of two specific tags in this file and put them in a csv file. The first tag is the : And the second one is a url with : My problem is that in the

PHP – Multiple OR operators in if statement

I am working with getters and setters within my Symfony project. I have to use if() statement to check if status field does not have specific values before changing other field. Code: I defined constants and also using OR operator. I was wondering if there is more elegant solution than this. Maybe is_array() …