1. Go to this page and download the library: Download convenia/checklistable 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/ */
convenia / checklistable example snippets
namespace App\Model;
use Illuminate\Database\Eloquent\Model;
use Convenia\Checklistable\Traits\ChecklistableTrait;
class ModelClass extends Model
{
use ChecklistableTrait;
// Return Collection of questions
ModelClass::checklist($type, $ownerId)
->questions()
->get();
// add and return question in lot (only if empty)
ModelClass::checklist($type, $ownerId)
->questions()
->fill([]);
// delete one question
ModelClass::checklist($type, $ownerId)
->questions()
->delete($questionId);
// add one question an d return all
ModelClass::checklist($type, $ownerId)
->questions()
->add([
'question' => 'What does Marcellus wallace looks like ?'
]);