hybridelabs/collustro

Create surveys for Laravel the easy way.

0.9.7 2020-12-23 14:43 UTC

This package is auto-updated.

Last update: 2024-04-23 20:41:14 UTC


README

Surveys made easy for Laravel

Installation

Require the package with composer:

composer require hybridelabs/collustro

Publish the migrations (required), the configuration (optional) and views (recommended):

php artisan vendor:publish --provider="HybrideLabs\Collustro\CollustroServiceProvider" --tag="migrations"
php artisan vendor:publish --provider="HybrideLabs\Collustro\CollustroServiceProvider" --tag="config"
php artisan vendor:publish --provider="HybrideLabs\Collustro\CollustroServiceProvider" --tag="views"

Run the migrations to create the required tables:

php artisan migrate

Usage

Create a survey

A simple one:

$collustro = Sets::create(["name" => "Animals"]);
$collustro->questions()->create([
    "content" => "Your favorite pet?",
    "type"    => "text",
]);

Add an Entry

From an array:

(new Entry())->for($collustro)->fromArray([
    "q1" => "My kitty."
]);