PHP code example of mjducharme / laravel-model-json-storage

1. Go to this page and download the library: Download mjducharme/laravel-model-json-storage 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/ */

    

mjducharme / laravel-model-json-storage example snippets


// laravel model json storage
// https://github.com/mjducharme/laravel-model-json-storage
$this->app->register(Okipa\LaravelModelJsonStorage\ModelJsonStorageServiceProvider::class);

class MyTestModel extends Illuminate\Database\Eloquent\Model
{
    use Okipa\LaravelModelJsonStorage\ModelJsonStorage;
    
    [...]
}

$testModel = app(MyTestModel::class)->create([
    'name' => 'John Doe',
    'email' => '[email protected]',
    'password' => Hash::make('secret'),
]);

$testModel = app(MyTestModel::class)->all();

$testModel = app(MyTestModel::class)->where('email', '[email protected]')->first();

$testModel->update([
    'name' => 'Gary Cook'
]);

$testModel->delete();
bash
php artisan vendor:publish --tag=model-json-storage::config