PHP code example of paulvl / magicmodel

1. Go to this page and download the library: Download paulvl/magicmodel 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/ */

    

paulvl / magicmodel example snippets


	
	. . .
	class User extends MagicModel implements UserInterface, RemindableInterface {
	. . .

	


	return dd(Model::hasReferences(1));
	//returns True if primary key "1" is referenced in any table as FK.
	//returns False if primary key "1" is NOT referenced in any table as FK.


	$object = Model::find(1);
	return dd($object->isReferenced());
	//returns True if the object is referenced in any table as FK.
	//returns False if the object is NOT referenced in any table as FK.