PHP code example of michaelachrisco / readonly
1. Go to this page and download the library: Download michaelachrisco/readonly 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/ */
michaelachrisco / readonly example snippets
use Illuminate\Database\Eloquent\Model;
use MichaelAChrisco\ReadOnly\ReadOnlyTrait;
class User extends Model {
use ReadOnlyTrait;
}
$legacyUser = new User;
$legacyUser->set_user_name('bob');
$result = $legacyUser->save();
//User is not saved.
//ReadOnlyException is thrown.