PHP code example of tilakputta / laravel-make-mongo
1. Go to this page and download the library: Download tilakputta/laravel-make-mongo 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/ */
tilakputta / laravel-make-mongo example snippets
protected $commands = [
\TilakPutta\Console\ModelMakeCommand::class
];
namespace App\Models;
use Jenssegers\Mongodb\Eloquent\Model;
class PermissionRole extends Model
{
protected $collection = 'permission_roles';
protected $fillable = [
];
protected $primaryKey = 'id';
public $incrementing = false;
/**
* model life cycle event listeners
*/
public static function boot(){
parent::boot();
static::creating(function ($instance){
if (!$instance->exists) {
$instance->id = uniqid();
}
});
static::created(function ($instance){
});
}
}
php artisan make:model ModelName
php artisan make:model Models/PermissionRole