gazsp/eloquent-cockpit

Use Laravel Eloquent and Cockpit together
6 8
Install
composer require gazsp/eloquent-cockpit:dev-master
License:MIT
Last Updated:Jun 2, 2015
Links: GitHub  ·  Packagist
Maintainer: gazsp

gazsp/eloquent-cockpit

Use Cockpit and Laravel Eloquent, together at last. Uses jenssegers/laravel-mongodb.

MongoDB only at the moment

Installation

composer require jenssegers/mongodb
composer require gazsp/eloquent-cockpit

Lumen

Make sure Facades are enabled in app.php, and that the jenssegers/laravel-mongodb service provider is loaded:

$app->withFacades();
// ...
$app->register('Jenssegers\Mongodb\MongodbServiceProvider');

Laravel

TBC (probably no different from Lumen)

Usage

If you have a collection called 'Events' in Cockpit, the model in Laravel or Lumen would be:

<?php namespace App\Repo\Collections;

    use Gazsp\EloquentCockpit\CockpitCollection;

    class Events extends CockpitCollection {
       protected $cockpitSlug = 'events';
    }

You can then use the model as normal:

$events = Events::all();
// etc...

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

648,266,899 9,701
laravel/framework

The Laravel Framework.

598,760,099 34,966
laravel/tinker

Powerful REPL for the Laravel framework.

512,508,631 7,443
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

429,221,767 607
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

403,217,078 4,664