I have looked for days, but my user never gets authenticated when using the auth middleware. We don’t use the standard laravel way, but using the standard auth middleware to block access to a route group. (in this example the dashboards) The data is correct as it doesnt give any error message, but the u…
What does this $_SERVER[‘REQUEST_METHOD’] === ‘POST’ do?
A little new to php and reading some people’s code and saw this: I get what isset(…) is doing but don’t understand the what the first if statement. Especially because the if statement was working when my request method was GET but wasn’t when my request method was POST Answer say your …
Is there any better way to get Currency Exchange Rate in PHP?
Currency Exchange Rate with below code is working sometimes and not working sometimes and not at all reliable. Is there any better way to get Currency Exchange Rate in PHP? Answer You have several issues: You’re not calling an actual API, you’re scraping a web page, which means that: you’re …
How to create a function in twig to calculate the age of a person using Symfony
I have this PHP code that works but I would like to be able to use the same but within twig in symfony. Answer To make this code guide me in this post: https://es.stackoverflow.com/a/73288/6524 The only variant in the file EdadUsuarioExtension.php
PHP how to do math in foreach cycle
I have a dynamical fields that contains values and i need to do math with them. What is the way to do it in foreach, do i have to save each value at the end of each loop? Example there is 4 fields: What i have is that I print these dynamical values into table and the table adapts users
Yii2: How to redirect to with UrlManager?
In my Yii2 config I have: If I go to site.com/search it works. If I go to site.com/site/index it also works and shows the same content. How to redirect the call instead of just showing the response of site/index? It must also redirect with params (site.com/site/index?param=1 -> site.com/search?param=1) Ans…
How can i take the element name inside the Html
How can i able to find the date format in UTC from the html element 2018-06-14T03:00:00.000Z. I am new in php so i don’t know how to grab it. Answer You might do it using find for getting the div with classname fi-mu__info__datetime and then getting the data-utcdate: If you only want the first one you c…
Laravel multi result set query builder
I have a MSSQL stored procedure : And i am executing this with my laravel app : It just returns me the first SELECT query result. How can i get both result sets? Answer Solved by writing bellow function :
I have an issue with product reviews summary bars WooCommerce
I want to create a product review summary just like this: And this is my try, it works like I want but the problem is not working for each product, it gives a summary of all products 🙁 And I think …
laravel – How can I get the user information of each comment
I have these Models: class Post extends Model { protected $primaryKey = ‘post_id’; public function comments() { return $this->hasMany(Comment::class, ‘post_id’, ‘post_id’); …