PHP code example of chaoswd / laravel-mongo-models

1. Go to this page and download the library: Download chaoswd/laravel-mongo-models 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/ */

    

chaoswd / laravel-mongo-models example snippets




namespace App\Models;

use MongoDB\Laravel\Eloquent\Model;

class User extends Model
{
    protected $connection = 'mongodb';
    protected $collection = 'users';

    protected $guarded = [];
}
bash
php artisan make:mongo:model User --collection="users"

app/Models/User.php