Code Monkey home page Code Monkey logo

checklistable's Introduction

checklistable logo

               

Codacy Badge Codacy Badge Build Status GitHub forks Dependencies GitHub Issues Contributions welcome License

Basic Overview

Add checklist in your project associated any model in your project

Install

composer require convenia/checklistable

publish migrations

php artisan vendor:publish --tag="checklistable"

migrate

php artisan migrate

Usage

add a trait

namespace App\Model;

use Illuminate\Database\Eloquent\Model;
use Convenia\Checklistable\Traits\ChecklistableTrait;

class ModelClass extends Model
{
    use ChecklistableTrait;    

Checklist Methods

checklist()
// Return ChecklistService Object
ModelClass::checklist($type, $ownerId);  
checklist()->get()
// Return Checklist Model, if not existe will create it
ModelClass::checklist($type, $ownerId)->get();  

Question Methods

checklist()->questions()
// Return QuestionService Object
ModelClass::checklist($type, $ownerId)
    ->questions();  
checklist()->questions()->get()
// Return Collection of questions
ModelClass::checklist($type, $ownerId)
    ->questions()
        ->get();  
checklist()->questions()->fill()
// add and return question in lot (only if empty)
ModelClass::checklist($type, $ownerId)
    ->questions()
    ->fill([]);  
checklist()->questions()->delete()
// delete one question
ModelClass::checklist($type, $ownerId)
    ->questions()
    ->delete($questionId);  
checklist()->questions()->add()
// add one question an d return all
ModelClass::checklist($type, $ownerId)
    ->questions()
    ->add([
        'question' => 'What does Marcellus wallace looks like ?'
    ]);  

Answer Methods

checklist()->answer()
// Return QuestionService Object
ModelClass::checklist($type, $ownerId)
    ->answer();  
checklist()->answer()->get()
// retrive all answers about checklistable, if do not have, fill it
ModelClass::checklist($type, $ownerId)
    ->answer()
    ->get($checklistableId);  
checklist()->answer()->start()
// fill the answers with the questions
ModelClass::checklist($type, $ownerId)
    ->answer()
    ->start($checklistableId);  
checklist()->answer()->answer()
// change answer response
ModelClass::checklist($type, $ownerId)
    ->answer()
    ->start($checklistableId, $answerId, $answer = true)

License

Checklistable is open-sourced software licensed under the MIT license

checklistable's People

Contributors

codacy-badger avatar edbizarro avatar euventura avatar stefanoducci avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

checklistable's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.