Skip to content

Instantly share code, notes, and snippets.

View farindra's full-sized avatar

Farindra farindra

View GitHub Profile
php artisan migrate --path=/database/migrations/selected/
//get data from csv
if (($handle = fopen ( 'database\\seeds\\datas\\customer_group.csv', 'r' )) !== FALSE) {
while ( ($data = fgetcsv ($handle, 1000, ',' )) !== FALSE ) {
$csv_data = new \App\Models\CustomerGroup;
// $csv_data->id = $data [0];
$csv_data->decode = $data [0];
$csv_data->name = $data [1];
$csv_data->save ();
}
fclose ( $handle );
$q->whereDay('created_at', '=', date('d'));
$q->whereMonth('created_at', '=', date('m'));
$q->whereYear('created_at', '=', date('Y'));
SELECT MAX(id) FROM customer;
SELECT nextval('customer_id_seq');
SELECT setval('customer_id_seq', (SELECT MAX(id) FROM customer)+1);
@farindra
farindra / php-ping.php
Created July 1, 2017 02:10 — forked from k0nsl/php-ping.php
PHP ping script
<?php
/*
*
* Use the examples below to add your own servers. Coded by clone1018 [?]
*
*/
$title = "Simple Server Status"; // website's title
$servers = array(
'Google Web Search' => array(
@farindra
farindra / calcprime.php
Created November 6, 2017 13:57 — forked from lawlesst/calcprime.php
PHP functions for calculating prime numbers.
<?php
/**
* Check to see if a given integer is prime.
*
* Adapted from this Python implementation http://pthree.org/2007/09/05/prime-numbersin- python/
* This list of the first 10,000 prime numbers is also helpful http://primes.utm.edu/lists/small/10000.txt
*
* @param int $number the number to check to see if it is prime.
* @return boolean true if the number is prime, false if not.
@farindra
farindra / database.php
Created January 16, 2018 07:31
Simple MySqli Php Library Connnection database
<?php
/**
*
*/
class database
{
private $connection;
public function __construct($hostname=DB_HOST, $database=DB_NAME, $username=DB_USER, $password=DB_PASS, $port = '3306') {
@farindra
farindra / .htaccess
Last active February 14, 2018 09:10
htacces laravel folder in root document
Devan Kampret
@farindra
farindra / AppServiceProvider.php
Created February 20, 2018 17:43
How to force HTTPS in Laravel 5.4+ By default Laravel generates URLs with HTTP instead of HTTPS. This is great when developing locally on your machine, but on a production server you probably got Let's Encrypt and HTTPS. Forcing HTTP from AppServiceProvider
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
@farindra
farindra / alias.cmd
Created April 11, 2018 05:58 — forked from jatubio/alias.cmd
Alias to develop on Windows with Laravel
@echo off
:::: Commands ::::
:: DosKey ::
:: Creates a new alias
doskey dk=doskey $*
:: Lists current aliases
doskey dkm=doskey /macros