- Website: http://laravel.com/
- October CMS gist: https://gist.github.com/hofmannsven/e71b90092fde4dc5cff9
- Laravel cheatsheet: http://cheats.jesse-obrien.ca/
- Laravel 5 cheatsheet: https://aufree.github.io/laravel5-cheatsheet/
- Laravel IDE helper for PhpStorm: https://github.com/barryvdh/laravel-ide-helper
Show version: php artisan --version
Show all commands: php artisan list
Show all routes: php artisan route:list
Key: php artisan key:generate
Problem: $ vagrant up
results in authentication failure.
default: Warning: Authentication failure. Retrying...
Solution: SSH into the VM via $ ssh vagrant@localhost -p 2222
and remove and regenerate the private keys:
wget https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub -O .ssh/authorized_keys
chmod 700 .ssh
chmod 600 .ssh/authorized_keys
chown -R vagrant:vagrant .ssh
Install Mcrypt via Homebrew: brew install mcrypt
Make sure to grant Apache access to store data within storage
:
storage/app
storage/framework
storage/logs
See: https://gist.github.com/hofmannsven/8392477#permissions
Daily logs: Add APP_LOG=daily
to your .env
config file (see config/app.php
).
Follow: https://scotch.io/quick-tips/quick-tip-using-laravel-blade-with-angularjs
Populate: php artisan db:seed
Populate a specific database: php artisan db:seed --database mysql_testing
Create new migration: php artisan make:migration create_tasks_table --create=tasks
» see database/migrations
Migrate: php artisan migrate
Migrate, again: php artisan migrate:refresh
Migrate a specific database: php artisan migrate --database mysql_testing
Create new model: php artisan make:model Task
» see app
Create new model and do migration: php artisan make:model Task -m
Create new policy: php artisan make:policy TaskPolicy
» see app/Policies
Create views: php artisan make:auth --views
» see resources/views/auth
Create: php artisan make:middleware BeforeMiddleware
» see app/Http/Middleware
Note: The name of the event is usally set in past tense (event is already done).
Add new event with listeners in app/Providers/EventServiceProvider.php
Create new events automatically based on your EventServiceProvider
: php artisan event:generate
» see app/Events
and also app/Listeners
Create command: php artisan make:console AppAbout --command=app:about
» see app/Console/Commands
Register new command: » see app/Console/Kernel.php
Usage: php artisan app:about
- PHPUnit cheatsheet: https://gist.github.com/hofmannsven/67deb0d36c991246b0a0
Usage: php artisan make:test UserTest
Add testing database credentials to your phpunit.xml
file:
<env name="DB_HOST" value="192.168.10.10"/>
<env name="DB_DATABASE" value="homestead"/>
<env name="DB_USERNAME" value="homestead"/>
<env name="DB_PASSWORD" value="secret"/>
Use temporary in memory database:
<env name="DB_CONNECTION" value="sqlite"/>
<env name="DB_DATABASE" value=":memory:"/>
Re-generate autoload: composer dump-autoload
Cache: php artisan route:cache
Clear: php artisan route:clear
Usage: php artisan tinker
E.g. create User: $user = factory(App\User::class)->create();