Wallogit.com
2017 © Pedro Peláez
Some laravel commands.
Some commands and traits., (*1)
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system., (*2)
Install Laravel:, (*3)
laravel new my-project cd my-project
Install mauroerta/laravel, (*4)
cd path/to/your/laravel/project composer require mauroerta/laravel
And then publish the configuration file and the migrations, run:, (*5)
php artisan vendor:publish
and follow the instructions., (*6)
Now you have 2 new commands:, (*7)
php artisan make:trait php artisan make:observer Name --observe=App\\Class\\To\\Observe
Example of make:observer command:, (*8)
php artisan make:observer UserObserver --observe=App\\User
Now you have a new file (UserObserver.php) in app/Observers/, Register the observer in the AppServiceProvider:, (*9)
namespace App\Providers;
// ...
use App\Observers\UserObserver;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
// ...
App\User::observe(UserObserver::class);
}
More information about Observers can be found here: Laravel Observers, (*10)
Linkable Trait, Slugable Trait, Draftable Trait. Description soon., (*11)