PHP code example of sinevia / laravel-entity
1. Go to this page and download the library: Download sinevia/laravel-entity 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/ */
sinevia / laravel-entity example snippets
// 1. Create your model class
class Note extends \Sinevia\Entities\Models\Entity {
function getType()
{
return 'note';
}
}
// 2. Create new instance and add fields
$note = new Note();
$note->save();
$note->setFieldValue('Title','Note title');
$note->setFieldValue('Text','Note text');
// 3. Create new instance and add fields
$note = Note::find($noteId);
echo $note->getFieldValue('Title');
echo $note->getFieldValue('Text');
// 4. Iterate throuhh all notes
$note = Note::all();
foreach($notes as $note){
echo $note->getFieldValue('Title');
}