2017 © Pedro Peláez
 

library maven

A Laravel package to manage FAQ.

image

sukohi/maven

A Laravel package to manage FAQ.

  • Tuesday, January 30, 2018
  • by Sukohi
  • Repository
  • 1 Watchers
  • 5 Stars
  • 1,033 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 8 Forks
  • 1 Open issues
  • 17 Versions
  • 2 % Grown

The README.md

Maven

A Laravel package to manage FAQ.
(This package is for Laravel 5.3+), (*1)

Demo, (*2)

'Example', (*3)

Requirements

Installation

Execute the next command., (*4)

composer require sukohi/maven:4.*

Set the service providers in app.php, (*5)

'providers' => [
    ...Others...,
    Collective\Html\HtmlServiceProvider::class,
    Sukohi\Cahen\CahenServiceProvider::class,
    Sukohi\Maven\MavenServiceProvider::class,
]

Also alias, (*6)

'aliases' => [
    ...Others...,
    'Form' => Collective\Html\FormFacade::class,
    'Html' => Collective\Html\HtmlFacade::class,
    'Cahen'   => Sukohi\Cahen\Facades\Cahen::class,
    'Maven'   => Sukohi\Maven\Facades\Maven::class,
]

Then execute the next commands., (*7)

php artisan vendor:publish
php artisan migrate

Usage (Management page)

Set Maven::route() in your routes.php., (*8)

\Sukohi\Maven\Maven::route();

// or with default locale

\Sukohi\Maven\Maven::route('en');

Now you can access to http(s)://YOUR-DOMAIN/admin/maven.
Note: I believe that you need to authenticate in routes.php before calling Maven::route() using middleware or something., (*9)

[Config]
After publishing, you should have maven.php in your config folder.
you can set some values in the file like the followings., (*10)

locales, (*11)

First of all, you have only en locale.
You can add more locales if you want like so., (*12)

'locales' => [
    'en' => 'English',
    'ja' => 'Japanese',
    'es' => 'Spanish'
],

// or

'locales' => [
    'ja' => '日本語',
    'en' => '英語',
    'es' => 'スペイン語'
],

// The keys and values refer locale symbols and language names.

URI, (*13)

The default value is admin/maven.
So http(s)://YOUR-DOMAIN/admin/maven is the URL for managing FAQs., (*14)

Per Page, (*15)

You can change maximum records per page., (*16)

Usage (Retrieve data)

[Basic Way], (*17)

$faqs = \Maven::get();

foreach ($faqs as $faq) {

    if($faq->hasLocale('en')) {

        // FAQ
        echo $faq->getQuestion('en');
        echo $faq->getRawQuestion('en');
        echo $faq->getAnswer('en');
        echo $faq->getRawAnswer('en');

        // Tag(s)
        $tags = $faq->getTags('en');    // Collection

        // Others
        echo $faq->sort_id;
        echo $faq->unique_key;
        echo $faq->created_at;
        echo $faq->updated_at;

    }

}

[Filtering], (*18)

Tag(s), (*19)

$faqs = \Maven::tag([
    'en' => 'YOUR-TAG'
])->get();

// or

$faqs = \Maven::tag([
    'en' => ['YOUR-TAG', 'YOUR-TAG'],
    'ja' => 'タグ'
])->get();

(Raminsadeghi indecated an error here for me. Thank you for kind of you!), (*20)

Unique Key, (*21)

$faq = \Maven::uniqueKey('952557a09ef19aae1d9e2a276db18a66')->first();

// or 

$faqs = \Maven::uniqueKey([
    '952557a09ef19aae1d9e2a276db18a66', 
    'fashrtrhstgrfaeargthukfyhdredeff', 
])->get();

Pagination, (*22)

{!! $faqs->links() !!}

All Tag(s), (*23)

$tags = \Maven::getAllTags();

// or with $draft_filter_flag

$tags = \Maven::getAllTags($draft_filter_flag = true);

In this case, if you'd like to get en tag(s), you should call like so., (*24)

$english_tags = $tags['en'];

Model Instance

In order to get model instance of this package, you can use getModel()., (*25)

\Maven::getModel('unique_key');
\Maven::getModel('faq');
\Maven::getModel('tag');

Export/Import

You can two commands for export/import., (*26)

[Export], (*27)

php artisan maven:export
  • Exported file is located at storage/app/maven/maven_faqs.json, storage/app/maven/maven_tags.json and storage/app/maven/maven_unique_keys.json.

[Import], (*28)

php artisan maven:import

Contributor

PapaDragonov, (*29)

License

This package is licensed under the MIT License.
Copyright 2016 Sukohi Kuhoh, (*30)

The Versions

30/01 2018

dev-master

9999999-dev

A Laravel package to manage FAQ.

  Sources   Download

MIT

The Requires

 

by Avatar Sukohi

31/01 2017

4.0.x-dev

4.0.9999999.9999999-dev

A Laravel package to manage FAQ.

  Sources   Download

MIT

The Requires

 

by Avatar Sukohi

31/01 2017
30/01 2017

3.0.x-dev

3.0.9999999.9999999-dev

A Laravel package to manage FAQ.

  Sources   Download

MIT

The Requires

 

by Avatar Sukohi

30/01 2017
03/10 2016
23/09 2016

2.0.x-dev

2.0.9999999.9999999-dev

A Laravel package to manage FAQ.

  Sources   Download

MIT

The Requires

 

by Avatar Sukohi

23/09 2016
23/09 2016
23/09 2016
06/07 2016

2.0.3

2.0.3.0

A Laravel package to manage FAQ.

  Sources   Download

MIT

The Requires

 

by Avatar Sukohi

06/07 2016

2.0.2

2.0.2.0

A Laravel package to manage FAQ.

  Sources   Download

MIT

The Requires

 

by Avatar Sukohi

06/07 2016

2.0.1

2.0.1.0

A Laravel package to manage FAQ.

  Sources   Download

MIT

The Requires

 

by Avatar Sukohi

06/07 2016

2.0.0

2.0.0.0

A Laravel package to manage FAQ.

  Sources   Download

MIT

The Requires

 

by Avatar Sukohi

13/11 2015

1.0.x-dev

1.0.9999999.9999999-dev

A Laravel package to manage FAQ.

  Sources   Download

MIT

The Requires

 

by Avatar Sukohi

13/11 2015

1.0.1

1.0.1.0

A Laravel package to manage FAQ.

  Sources   Download

MIT

The Requires

 

by Avatar Sukohi

13/11 2015

1.0.0

1.0.0.0

A Laravel package to manage FAQ.

  Sources   Download

MIT

The Requires

 

by Avatar Sukohi