I have a Laravel 7 app with a polymorphic relationship saved in the database. I also have another Laravel 8 app querying the same database. The problem is Laravel 7 saves the morph type as “AppModel” while Laravel 8 saves as ‘AppModelsModel’. So when I’m querying the relationship…
openssl_encrypt aes 256 with hash in java
From the php encryption function below: the result of encryption is MyFTCJx8RPzOx7h8QNxEtQgeiNIRwnrJ+uc0V70= And I have try to write this function in Java like this: The result is amF2YXguY3J5cHRvLnNwZYUmrJNv8ycvLua0O9g= Why my java function return the different result from php? And how do I fix the java func…
Laravel – Too slow sitemap creation (Apache and Node.js installed on the same server)
I am running two Angular2+ projects and a Laravel API on my server together. The first angular project is a public website for users (SSR enabled), the second angular project is Admin Panel (SSR not enabled), these two projects run on Laravel API. I have a strange problem with sitemap creation. I am using thi…
Should I increase the PHP memory_limit to match my VM memory_limit?
I have a doubt if I should do this or not. I have a VM with 4 GBs RAM from Linode. I want to optimize what I paid for and increase the default value of memory_limit in php.ini to allow my Laravel application to take much more than the default value. Will this help my Laravel application load faster? Is
Show/hide custom field based on a select field with validation in WooCommerce checkout
I have added a custom select field and a custom text field on the checkout page in WooCommerce using the code below. I want to hide this text field by default and it should only be visible when the “Referral Program” option is selected from the select field Here is my code, which works. Except tha…
Insert into PDO with IF clause
I need some help with inserting some data into a sql server table using the IF clause. I have the return of an API that I insert in the table of the sql server. However, as I will schedule my code every day to get the update from the API to see if there is anything new, but every time
join a single table twice in join query
I have 3 tables users and meeting table and user_role. In user table I have user_name and user_role fields and in meeting table I have the column meeting_id assigned_username and created_by_user_name fields and In user_roles table have id and role . I want to get the assigned_user_name’s user_role and c…
If I dont use this code the instagram image is never displayed
The picture is displayed in my website only when I use this code … but if use this: It shows corrupted image like here: https://i.imgur.com/ufJHy1n.png and it happens only with instagram images because the ending of the url is not like xxxx.jpg Please help ! Answer If you had used your browser’s c…
Laravel collection – Group by months in a year and show the missing months from table with a count of 0
I am trying to create a collection in laravel which groups the current year into months with a supplied count. So far so good. The thing is, which indeed is obvious, collection is not showing the months that doesn’t exist in the table. By using the following code I get an output as follows The collectio…
I can’t get JWT token in Laravel
I am creating an API in Laravel 8 (PHP 7.4) and I wanted to secure it. The choice fell on tymon / jwt-auth. I follow the documentation from the website: https://jwt-auth.readthedocs.io/en/develop/quick-start/ Everything works fine here. However, later when I create a route to login and want to get the token u…