PHP code example of visiarch / laravel-trait
1. Go to this page and download the library: Download visiarch/laravel-trait library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
visiarch / laravel-trait example snippets
namespace App\Traits;
/**
* Trait Loggable
* @package App\Traits
*/
trait Loggable {
// write your code here
}
trait Loggable {
public function log($message) {
return $message;
}
}
class User {
use Loggable;
}
class Order {
use Loggable;
}
$user = new User();
$user->log('User created');
$order = new Order();
$order->log('Order placed');
bash
$ php artisan make:trait Loggable