Skip to content

Instantly share code, notes, and snippets.

@a7madev
Last active July 3, 2017 06:03
Show Gist options
  • Save a7madev/dd4aa2fadaaf09454cc2e1418487258f to your computer and use it in GitHub Desktop.
Save a7madev/dd4aa2fadaaf09454cc2e1418487258f to your computer and use it in GitHub Desktop.
Laravel

Setup

mkdir bootstrap/cache
mkdir storage/cache
mkdir storage/sessions
mkdir storage/system/files

PHP version

https://gist.github.com/irazasyed/5987693

Commands

npm install
composer install
bower install
gulp
composer dump-autoload

Push to Server

php artisan down
git pull
composer install
php artisan migrate
gulp
composer dump-autoload
php artisan up

Laravel All

Make Migration

php artisan make:migration create_teacher_subjects_table

Git

Initialize git

init git

Add remote git

git remote add origin https://github.com/A7maDev/repo.git
git branch --set-upstream master origin/master

Switch to branch

git checkout master

Force delete a branch

git branch -D staging

Force delete a branch

git reset --hard HEAD~1

OR

git reset --soft HEAD~1

Refresh Remote Branches

git branch -a
git remote update origin --prune

Setup

npm install

composer

composer install
composer dump-autoload

artisan

php artisan migrate
php artisan serve

Generate the key

php artisan key:generate

Create migration

php artisan migrate:make create_users_table

NPM

Chaning npm cache folder

npm config set cache D:\nodejs\npm-cache --global

Clear Cache

npm cache clean

PHP Laravel

Modify Request Info

$request->replace(array('inputname' => 'new value'));
$request->merge(array('inputname' => 'new value'));

Model

protected $table = 'my_flights';
protected $fillable = ['name'];
protected $guarded = ['price'];

Run Artisan Command

Artisan::call('migrate', ['--package'=>'cartalyst/sentry']);

Two Primary Keys

 $table->primary(['id_tag', 'id_doc']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment