Download the PHP package oza75/laravel-hubble without Composer

On this page you can find all versions of the php package oza75/laravel-hubble. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-hubble

Laravel Hubble

Latest Version on Packagist Build Status Quality Score Total Downloads

Build a beautiful dashboard with laravel in no time.

Requirements

Installation

You can install the package via composer:

Then install laravel-hubble

Now go to : http://yourapp.tld/hubble (or http://localhost:8000/hubble if you use artisan serve)

Authentification

Hubble uses the default Laravel authorization gate to check if a user can access to the dashboard. By default, everyone can access to hubble dashboard. You can restrict access by using authorizesAccess method on App\Providers\HubbleServiceProvider.

Usage

Resources

A hubble resource is a simple php class which aims to represent the resource you want to add, namely the different fields, actions, filters, etc. that it has.

Create resource

You can create a new resource by running hubble:resource command

This will automatically create a new resource under app/Hubble folder

After your resource is generated, you need to set the eloquent builder hubble should use to get your data. When generating this resource we will try to obtain the eloquent builder according to the name of the resource passed in php artisan hubble:resource command. You can modify this query builder to add some computed fields.

fields method is used to return all fields your want to display. By default, hubble comes with some fields like TextField, TextareaField, ImageField and more. But you can also create your own custom field.

Configure your resource

You can configure your resource by setting some properties on your resource class.

If you want to customize the title that should be shown in each different screen (index page, edit page, details page etc...) you may define configure method in your resource. For example:

Registering your resource

By default, hubble will automatically register all resources you have under app/Hubble folder.

Just go to http://yourapp.tld/hubble and you will see the new user resource that we add.

You can customize the folder within hubble must look for your resources in config file. The auto registration is very useful when developing your dashboard but you may disable it in production to gain a small performance.

In your app/Providers/HubbleServiceProvider.php :

Actions

Action is used to perform custom tasks on one or more Eloquent models. You can generate action using :

This command will generate a new ActiveUsers class under app/Hubble/Actions

The title property contains the name of the action that will be shown on the User Interface

In the handle method you can perform your action. For our example, let's assume that our users table has an active column which determine whether the user is active or not.

When you created your action you can add it in your resource.

Filters

As the name suggests, filters are used to filter your data and display only data that satisfy certain conditions. There are many ways to add filter into your resource :

Filter::make take as is first argument, the column in the database. The second argument is the title and then the third array of options.

The options' argument is an associative array where the key is the label and the value, the value of the option. You can also pass an url where the options should be fetched or a custom array. for those cases you may set the valueKey and the textKey using the setValueKey(string $key), and the setTextKey(string $key).

For example:

Another example:

With this way, you can use the setHandler method to pass a callable that takes the query builder as his first argument and the value of the filter, you can add any where clause you want.

This command will generate a new filter class under app/Hubble/Filters.

You can also generate a filter with a custom VueJs components.

This will generate a VueJs component under resources/hubble/components/filters/my-custom-filter.vue

Fields

Fields are used to display your data. the base Field class can be used to create fields. Any types of fields extend this class.

You can also tell to Hubble to sort your data by default using a certain field.

Custom Display

There are a few methods you can use to customize how you want to display the field value in the different sections of the dashboard.

The displayUsing method customize the display in all sections of the dashboard.

All these methods as the same signature.

Visibility

Field comes with some methods that you can use to tell when to display

All of these methods can pass a closure that will be used to hide or display the field on a specific screen.

Hubble ships with many types of fields, but you can also create your own.

TextField

Used to display a text Field.

this type will be used to display correct input type in forms.

limit the number of character that should be displayed in tables.

BooleanField

the text method set the text to display when this field has true or false value.

NumberField

Used to display number values

TextareaField

Used to display long text values

DateTimeField

Used to display dates values

SelectField

ColorField

Used to display colors

FileField

Used to display and upload files

Limit number of files

ImageField

Used to display image and upload images.

ImageField extends to FileField so it has all methods that FileField has, such as multiple or max.

or

BelongsToField

Used to display a related resource

The first argument is the name relationship method. Let's assume we have in our User model a belongsTo method to City Model.

Then to add this relationship in our resource

HasManyField

Used to display related resources

As the BelongsToField, the HasManyField takes the relationship method name as his first argument.

Create a custom field

You can create a custom field by using this command:

You can also generate a new field with custom components by using this command:

This will create new VueJs components for your field under resources/hubble/components/fields/color

Use this command to build the newly components

or

php artisan hubble:field will generate a new Field Class under app/Hubble/Fields

Rules

You can automatically validate your forms data by setting rules on each field.

There are also rules methods for each creation and editing screen

Warning: the rules' method cannot yet take a validation object (such as a rule class) or a closure but any Pull Request is welcoming.

For frontend interactivity, you may set a handler that can be used to validate automatically your field value under resources/hubble/rules.js. If you don't, an ajax request will be sent to the backend to check if the value is valid when user is filling the form.

Authorization

Authorization is used to restrict access of certain screen of your dashboard. Internally, it uses mostly Laravel Authorization Gate.

You just need to create a Laravel Policy for your resource that will control which user can access or not to a specific screen.

For example, let's assume I have a Post model :

This will generate a new Laravel Policy under app/Policies.

Testing

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

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

Credits

License

The MIT License (MIT). Please see License File for more information.

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.


All versions of laravel-hubble with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1|^8.0
ext-json Version *
maatwebsite/excel Version ^3.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package oza75/laravel-hubble contains the following files

Loading the files please wait ....