All Projects → poowf → Otter

poowf / Otter

Licence: mit
A relatively automatic CRUD backend administration panel for Laravel

Projects that are alternatives of or similar to Otter

Core
AdminArchitect - Active Admin for Laravel
Stars: ✭ 194 (-25.67%)
Mutual labels:  laravel, backend, administration
Laravel Totem
Manage Your Laravel Schedule From A Web Dashboard
Stars: ✭ 1,299 (+397.7%)
Mutual labels:  hacktoberfest, laravel, dashboard
Laravel Starter
A CMS like modular starter application project built with Laravel 8.x.
Stars: ✭ 299 (+14.56%)
Mutual labels:  hacktoberfest, laravel, dashboard
Platform
A @laravel based RAD platform for back-office applications, admin/user panels, and dashboards.
Stars: ✭ 2,623 (+904.98%)
Mutual labels:  hacktoberfest, laravel, dashboard
Laravel Schedulable
Schedule and unschedule eloquent models elegantly without cron jobs
Stars: ✭ 78 (-70.11%)
Mutual labels:  hacktoberfest, eloquent-models, laravel
Nebula
Nebula is a minimalistic and easy to use administration tool for Laravel applications, made with Laravel, Alpine.js, and Tailwind CSS.
Stars: ✭ 190 (-27.2%)
Mutual labels:  hacktoberfest, laravel, dashboard
Chartbrew
Open-source web platform for creating charts out of different data sources (databases and APIs) 📈📊
Stars: ✭ 199 (-23.75%)
Mutual labels:  hacktoberfest, dashboard
Laravelpackage.com
Documentation for LaravelPackage.com: Learn to create Laravel specific PHP packages from scratch, following this open documentation.
Stars: ✭ 214 (-18.01%)
Mutual labels:  hacktoberfest, laravel
Urlhub
URL shortener web application based on the Laravel PHP Framework.
Stars: ✭ 217 (-16.86%)
Mutual labels:  hacktoberfest, laravel
Wagonwheel
Offer an online version of your Laravel emails to users.
Stars: ✭ 224 (-14.18%)
Mutual labels:  hacktoberfest, laravel
Librenms
Community-based GPL-licensed network monitoring system
Stars: ✭ 2,567 (+883.52%)
Mutual labels:  hacktoberfest, laravel
Onesignal
OneSignal notifications channel for Laravel
Stars: ✭ 222 (-14.94%)
Mutual labels:  hacktoberfest, laravel
Laravel Craftsman
Laravel Craftsman CLI for easily crafting Laravel assets for any project (artisan make on steroids)
Stars: ✭ 227 (-13.03%)
Mutual labels:  hacktoberfest, laravel
Laravel Executor
Configurable code that can be run when installing and updating your web app.
Stars: ✭ 204 (-21.84%)
Mutual labels:  hacktoberfest, laravel
Resources
This repo is a one stop destination to find resources for learning various domains. You can find the roadmap for any domain here.
Stars: ✭ 198 (-24.14%)
Mutual labels:  hacktoberfest, backend
Miracle Board
Just another simple and elegant status board / dashboard.
Stars: ✭ 217 (-16.86%)
Mutual labels:  hacktoberfest, dashboard
Laravel Surveillance
Put malicious users, IP addresses and anonymous browser fingerprints under surveillance, log the URLs they visit and block malicious ones from accessing the Laravel app.
Stars: ✭ 198 (-24.14%)
Mutual labels:  hacktoberfest, laravel
Larastan
⚗️ Adds code analysis to Laravel improving developer productivity and code quality.
Stars: ✭ 3,554 (+1261.69%)
Mutual labels:  hacktoberfest, laravel
Laravel Admin Starter
A Laravel Admin Starter project with Page Builder, Roles, Impersonation, Analytics, Blog, News, Banners, FAQ, Testimonials and more
Stars: ✭ 240 (-8.05%)
Mutual labels:  hacktoberfest, laravel
Gistlog
GistLog - simple, easy blogging based on GitHub gists
Stars: ✭ 237 (-9.2%)
Mutual labels:  hacktoberfest, laravel

Build Status Total Downloads Latest Unstable Version Latest Stable Version License

A relatively ottermatic (automatic) CRUD backend administration panel

Introduction

Otter was created as an open-source alternative to Laravel Nova. The backend administration panel is built with the beautiful tabler template and follows the structure of the popular laravel extension packages like horizon and telescope.

Otter is designed to handle almost everything for you through OtterResource files that essentially tie to your Eloquent Models.

Screenshots

Installation

Install Otter with composer:

$ composer require poowf/otter

In Laravel 5.5+, service providers and aliases are automatically registered. If you're using Laravel 5.5+, skip ahead directly to step 2.

Once the composer installation completes, all you need to do is add the service provider. Open config/app.php, and make the following changes:

  1. Add a new item to the providers array:

    Poowf\Otter\OtterServiceProvider::class,
    
  2. Install all the relevant Otter assets:

    If you are updating Otter, run php artisan otter:publish instead

    php artisan otter:install
    

Usage

Defining the Models to be registered to Otter is very simple. Let's create an OtterResource by running the following command:

php artisan otter:resource User

You may specify a model class name with the --model argument

This will generate a OtterResource file located in app/Otter.

OtterResource Conventions

This is an example of an OtterResource that is generated by the otter:resource command, which will be automatically registered by Otter.

<?php

namespace App\Otter;

use Poowf\Otter\Http\Resources\OtterResource;

class User extends OtterResource
{
    //
}

Model

The $model variable is where we define the Eloquent Model that the OtterResource is responsible for.

<?php

namespace App\Otter;

use Poowf\Otter\Http\Resources\OtterResource;

class User extends OtterResource
{
    /**
     * The model the resource corresponds to.
     *
     * @var string
     */
    public static $model = 'App\User';
}

Fields

The fields function will return a key value pair of the available columns that you would like to control in the Otter. They key is the name of the column in the model, and the value is the type of the input.

<?php

namespace App\Otter;

use Poowf\Otter\Http\Resources\OtterResource;

class User extends OtterResource
{
    /**
     * Get the fields and types used by the resource
     *
     * @return array
     */
    public function fields()
    {
        return [
            'name' => 'text',
            'password' => 'password',
            'email' => 'email',
        ];
    }
}

You can hide certain fields in the index and single view resources by defining a hidden function returning an array of the keys that you would like hidden. An example configuration would be to hide the password field for a User.

<?php

namespace App\Otter;

use Poowf\Otter\Http\Resources\OtterResource;

class User extends OtterResource
{
    /**
     * Fields to be hidden in the resource collection
     *
     * @return array
     */
    public function hidden()
    {
        return [
            'password'
        ];
    }
}

Validation

When creating or updating the resources in storage, you should add some validation rules to ensure that the data is stored correctly. You can do this for both the client and server side by defining a validations method in the OtterResource. The below example has defined rules for both the client and server side for the create and updated methods. The client side is utilising VeeValidate for validation so please see the available rules at the VeeValidate Rules Documentation. The server side is utilising the default Laravel Validation Rules.

/**
 * Get the validation rules used by the resource
 *
 * @return array
 */
public static function validations()
{
    return [
        'client' => [
            'create' => [
                'name' => 'required|min:4',
                'email' => 'required|email',
                'password' => 'required',
            ],
            'update' => [
                'name' => 'required|min:4',
                'email' => 'required|email',
                'password' => '',
            ]
        ],
        'server' => [
            'create' => [
                'name' => 'required|min:4',
                'email' => 'required|email|unique:users',
                'password' => 'required',
            ],
            'update' => [
                'name' => 'required|string|min:4',
                'email' => 'required|email|unique:users,email,' . auth()->user()->id,
                'password' => 'required',
            ]
        ],
    ];
}

Relationships

Otter has partial support for Eloquent relationships. You have to define your relationships in the OtterResource file and define the Relationship method name as the key and the OtterResource class name that links to the relationship.

You can also define a custom foreign key if you are not using the Laravel defaults.

The title property should be the column of the model that will be displayed in the options list during editing/creating of new resources .

<?php

namespace App\Otter;

use Poowf\Otter\Http\Resources\OtterResource;

class User extends OtterResource
{
    /**
     * The column of the model to display in select options
     *
     * @var string
     */
    public static $title = 'name';
        
    /**
     * Get the relations used by the resource
     *
     * @return array
     */
    public function relations()
    {
        return [
            'company' => ['Company', 'company_id'],
            'company' => 'Company',
        ];
    }
}

Authorization

Otter exposes a dashboard at /otter. By default, you will only be able to access this dashboard in the local environment. Within your app/Providers/OtterServiceProvider.php file, there is a gate method. This authorization gate controls access to Otter in non-local environments. You are free to modify this gate as needed to restrict access to your Otter installation:

/**
 * Register the Otter gate.
 *
 * This gate determines who can access Otter in non-local environments.
 *
 * @return void
 */
protected function gate()
{
    Gate::define('viewOtter', function ($user) {
        return in_array($user->email, [
            '[email protected]'
        ]);
    });
}

Configuration

After publishing Otter's assets, its primary configuration file will be located at config/otter.php.

This configuration file will allow you to configure the middleware for both the api and web routes that is automatically registered by Otter.

You can also configure the keys of the Auth::user() instance for the name and email properties that is used in the top right dropdown.

The pagination configuration value is used to display the number of records in the index pages.

'middleware.web' => ['web'],
'middleware.api' => ['api'],

'pagination' => 20,

'user' => [
    'name' => 'name',
    'email' => 'email',
],

Extras

A dark/night theme can be enabled by specifying Otter::night() in the boot method of the OtterServiceProvider

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].