Giter Club home page Giter Club logo

backpackmeta's Introduction

AbbyJanke/BackpackMeta

A package designed to help create Meta options for the extending core functions of Backpack such as users and other packages.

Install

This package is currently in development and is not recommended for a production environment.

  1. In your terminal:
$ composer require abbyjanke/backpackmeta
  1. Publish the config file & run migrations.
$ php artisan vendor:publish --provider="AbbyJanke\BackpackMeta\MetaServiceProvider" #publish config files and migrations
$ php artisan migrate #create the role and permission tables
  1. Within the new config/backpack/meta.php configuration file you will need to set a list of all models you wish to be accessible via the admin interface for meta fields. If you do not intend to use the admin interface then you can skip this step. Example:
'models' => [
    'App\Models\Monster',
    'App\User'
],
  1. Use the following traits on your Controller
<?php

namespace App\Http\Controllers\Admin;

use App\Http\Requests\MonsterRequest as StoreRequest;
use App\Http\Requests\MonsterRequest as UpdateRequest;
use Backpack\CRUD\app\Http\Controllers\CrudController;
use AbbyJanke\BackpackMeta\PanelTraits\Meta as MetaTrait; // <!-------------- This One

class MonsterCrudController extends CrudController
{
    use MetaTrait; // <!-------------- This one too

    public function setup()
    {
      $this->getMetaFields(); // <!-------------- And finally this one
    }
  1. Run the migration to have the database table we need:
php artisan migrate
  1. [optional] Add a menu item for it in resources/views/vendor/backpack/base/inc/sidebar.blade.php:
<li><a href="{{ url(config('backpack.base.route_prefix').'/meta') }}"><i class="fa fa-plus-square"></i> <span>Meta Options</span></a></li>

Retrieving Values

To retrieve a Meta value from a specific Record within your database you can call it the same was as any column within the model's main database such as:

$record->metaKeyName;

Not Using Backpack\CRUD?

Use Without a CRUDController

Security

If you discover any security related issues with this package, please email [email protected] instead of using the issue tracker. If you discover any security related issues with the Backpack core, please email [email protected] instead of using the issue tracker.

backpackmeta's People

Watchers

 avatar

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.