Skip to content

Instantly share code, notes, and snippets.

View arshohag's full-sized avatar
🎯
Focusing

Ashiqur Rahman arshohag

🎯
Focusing
View GitHub Profile
@arshohag
arshohag / phone-validation-sg-laravel.php
Last active November 5, 2022 17:35
Singapore Phone Number validation in Laravel
<?php
$this->validate($request, [
'phone' => 'regex:/^\+65(6|8|9)\d{7}$/',
]);
// It will validate SG phone numbers without a required parameter in laravel using validator.
@arshohag
arshohag / countries.sql
Created March 3, 2022 10:56
SQL countries table for Laravel/any SQL BD including all the Countries, ISO, ISO3, Country Codes, Phone codes
--
-- Table structure for table `countries`
--
DROP
TABLE IF EXISTS `countries`;
CREATE TABLE `countries` (
`id` int NOT NULL AUTO_INCREMENT,
`name` varchar(80) NOT NULL,
`iso` char(2) NOT NULL,
`iso3` char(3) DEFAULT NULL,
@arshohag
arshohag / woocommerce-function.php
Last active February 24, 2022 06:49
woocommerce functions.php code that disables all email notifications for guest customer order with "cheque" payment gateway.
/**
* Code goes in functions.php or a custom plugin.
*/
/**
* @snippet Disable Order notification For Specific Payment Gateway
* @author Ashiqur Rahman
*/
@arshohag
arshohag / gist:35f0266328df694631105c54a3e56678
Created February 12, 2022 12:34 — forked from mikejolley/gist:3097073
WooCommerce - Unhook/Disable emails
/**
* Code goes in functions.php or a custom plugin.
*/
add_action( 'woocommerce_email', 'unhook_those_pesky_emails' );
function unhook_those_pesky_emails( $email_class ) {
/**
* Hooks for sending emails during store events
**/
@arshohag
arshohag / transitions.css
Created May 18, 2021 02:13 — forked from robsonsanches/transitions.css
Force Bootstrap v4 transitions (ignores prefers-reduced-motion media feature)
/*
* Force Bootstrap v4 transitions
* (ignores prefers-reduced-motion media feature)
* https://gist.github.com/robssanches/33c6c1bf4dd5cf3c259009775883d1c0
*/
.fade {
transition:opacity 0.15s linear !important;
}
.collapsing {
@arshohag
arshohag / mailgun-config.md
Last active February 4, 2021 07:59 — forked from mrabbani/mailgun-config.md
Laravel Mailgun Setup
@arshohag
arshohag / passwordValidation.php
Created October 2, 2020 09:58 — forked from Michael-Brooks/passwordValidation.php
Laravel Password validation Regex (Contain at least one uppercase/lowercase letters and one number)
<?php
/*
* Place this with the rest of your rules.
* Doesn't need to be in an array as there are no pipes.
* Password is required with a minimum of 6 characters
* Should have at least 1 lowercase AND 1 uppercase AND 1 number
*/
$rules = [
'password' => 'required|min:6|regex:/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).+$/'
];
@arshohag
arshohag / test_mail_laravel.md
Last active March 31, 2020 11:05
test laravel mail server configuration using tinker

SSH into the server

Run

php artisan tinker

Run this following commnad

Mail::send('welcome', [], function($message) {
    $message->to('arshohag8@gmail.com')->subject('Testing mails');
});
@arshohag
arshohag / nigeria_state_city.sql
Created March 30, 2020 04:30
Nigeria State list & City list relation with State SQL
-- -- Table structure for table `states` --
CREATE TABLE IF NOT EXISTS `states` ( `id` int(10) NOT NULL AUTO_INCREMENT, `name` varchar(100) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=38 ;
-- -- Dumping data for table `states` --
INSERT INTO `states` (`state_id`, `name`) VALUES (1, 'Abia State'), (2, 'Adamawa State'), (3, 'Akwa Ibom State'), (4, 'Anambra State'), (5, 'Bauchi State'), (6, 'Bayelsa State'), (7, 'Benue State'), (8, 'Borno State'), (9, 'Cross River State'), (10, 'Delta State'), (11, 'Ebonyi State'), (12, 'Edo State'), (13, 'Ekiti State'), (14, 'Enugu State'), (15, 'FCT'), (16, 'Gombe State'), (17, 'Imo State'), (18, 'Jigawa State'), (19, 'Kaduna State'), (20, 'Kano State'), (21, 'Katsina State'), (22, 'Kebbi State'), (23, 'Kogi State'), (24, 'Kwara State'), (25, 'Lagos State'), (26, 'Nasarawa State'), (27, 'Niger State'), (28, 'Ogun State'), (29, 'Ondo State'), (30, 'Osun State'), (31, 'Oyo State'), (32, 'Plateau State'), (33, 'Rivers State'), (34, 'Sokoto
@arshohag
arshohag / dbLocalization controller
Created February 2, 2020 08:26
Laravel DB localization using voyager - custom response to replace patent column with translated data
/**
* Display a listing of the Relation resource.
*
* @return \Illuminate\Http\Response
*/
public function getRelations()
{
$relations = Relation::with('dbtranslations')->get();
if ($_SERVER['HTTP_ACCEPT_LANGUAGE'] ?? 'en' != 'en') {