I am unable to write the exact pattern for 10 digit mobile number (as 1234567890 format) in PHP . email validation is working. here is the code: Answer Mobile Number Validation You can preg_match() to validate 10-digit mobile numbers: To call it in a function: Email Validation You can use filter_var() with FI…
Tag: php
Laravel Distinct Count
Any way to make this query work using laravel? DB::raw or Eloquent usage doesn’t matter. SELECT count(DISTINCT name) FROM tablename; Here’s what i’ve tried but cannot get the proper output: …
Laravel custom helper – undefined index SERVER_NAME
In Laravel 5.1, I created a custom helper file: custom.php which I load in composer.json: and it contains this method: It works as expected, but every time I do php artisan commands, I get a call stack and this message: Why is this so? The method returns the correct value when run from within my Laravel app. …
Control repeated requests in Phalcon
I want to intercept the same request, so i write a flag in session if one request come, such like this: in Security.php/beforeExecuteRoute in ControllerBase.php/afterExecuteRoute But the session of write need real time, if the request send quickly, it will not work fine.For example,at the same time, only to a…
migrating a specific table in laravel
using command php artisan migrate migrates all the tables. but i have employees table that i migrated along with other tables. but it is not migrated (i cannot see it in phpmyadmin). now when i again use php artisan migrate command it displays nothing to migrate. How can i migrate that specific employees tabl…
Shopify password update using Shopify API
Can we update password for a User or Customer that already exists in Shopify using the Shopify API? Answer The User endpoint is available for Shopify Plus stores, but it is currently read only – no user management is possible via this API https://docs.shopify.com/api/reference/user
502 Bad Gateway: nginx, php5-fpm, 175/209 connect() failed (111: Connection refused) while connecting to upstream
Running shopware 5 on a Debian Jessie machine with nginx and php5-fpm, we get very often a 502 Bad Gateway. This happens mostly in backend when longer operations are working like thumbnail creation, even if this is done within small chunks of single ajax requests. The used server with 64 GB RAM and 16 Cores i…
Manually register a user in Laravel
Is it possible to manually register a user (with artisan?) rather than via the auth registration page? I only need a handful of user accounts and wondered if there’s a way to create these without having to set up the registration controllers and views. Answer I think you want to do this once-off, so the…
Custom defined routes not resolving in Laravel
I have a Laravel 5.2 instance utilizing all the typical out-of-the-box routes for dashboard, cases, home, login/logout, and users (which is working well). I now need to create a wizard with steps (step1, step2, step3, etc.), and I need access to the session. I assigned them to the group middleware. However, w…
Set max_execution_time for specific controller in symfony2
Using ini_set(), I can expand the maximum execution time of a script. In Symfony2, I can add ini_set to web/app.php and web/app_dev.php to apply the increased execution time to all controllers. But in this case, I only want to expand the maximum execution time for one specific controller action in Symfony2. I…