A regular expression (shortened as regex or regexp or rational expression) is a sequence of characters that specifies a search pattern in the text.A good testing site is https://infoheap.com/php-preg_match-online/ Examples of regex for passwordPHP Version/^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[a-zA-Z])(?=\S*[\W]).{8,}$/Must have special characters(?=\S*[\W])Must have a number(?=.*\\d)Must...
Thursday, 19 May 2022
Friday, 22 April 2022
Installing Laravel Command
<pre><code> composer global require laravel/installerecho 'export PATH="$HOME/.composer/vendor/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc</code></pre&...
Tuesday, 8 March 2022
Laravel Blade versioning for CSS or JS files
It will be a good idea to create css and js versioning for easy loading and somehow for changes to take effect.
You can add these code in your blade layout for your laravel project
...
Wednesday, 9 February 2022
Changing .env Programatically
With great powers comes great responsibility, changing .env values in the server
were great but if you don't have access to it this code might come in handy.
In your route, where key is the key, and value will be the new env value
Route::get('changeenv/{key?}/{value?}',"controller@methodname");
In your controller
public function changeEnv($key, $value)
{
$path = app()->environmentFilePath();
...
Tuesday, 8 February 2022
Laravel SMTP Settings for Different Mail Service Provider
Laravel SMTP Settings for Different Mail Service Provider
MAILHOG
brew update && brew install mailhog
For Laravel .env
MAIL_DRIVER=smtp
MAIL_HOST=0.0.0.0
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
Run in Terminal
mailhog
Testing Email
Open this link Mailhog UIJust continue sending em...
Monday, 7 February 2022
Makefile miscellaneous commands
Some miscellaneous commands for makefile
This command will cd to a page and run command inside the page, if successful succeeding commands will be called.
build:adminx font js
js:
npm run build
font:
npm run gulp iconfont
adminx:
cd admin; npm run build
...
Monday, 31 January 2022
Installing FontForge Using Brew
Commands used to install fontforge using brew and linking it afterward.
brew install fontforge
brew install ttfautohint fontforge (optional)
brew link fontforge
...
Thursday, 27 January 2022
PHP Google GeoCoding Getting Latitude & Longitude
private function getGeoLocation($address)
{
try {
$url = 'https://maps.google.com/maps/api/geocode/json';
$address = str_replace(["'", '"'], " ", $address);
$address = str_replace([" ", " "], "+", $address);
$query_array = array(
'address' => $address,
'key' => env('GOOGLE_MAP_API_KEY')
);
$query = http_build_query($query_array);...