gazsp/eloquent-cockpit

Use Laravel Eloquent and Cockpit together

Installs: 6

Dependents: 0

Suggesters: 0

Security: 0

Stars: 8

Watchers: 2

Forks: 0

Open Issues: 0

pkg:composer/gazsp/eloquent-cockpit

dev-master 2015-06-02 21:17 UTC

This package is not auto-updated.

Last update: 2025-10-15 13:40:12 UTC


README

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...