Skip to content

Rayiumir/laravel-metabox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Packagist Downloads Packagist Downloads Packagist Downloads Packagist License GitHub Release Packagist Dependency Version

Documentation

Static Badge

Laravel Metabox

MetaBox is a highly useful feature for retrieving or displaying WordPress information. We decided to bring this Meta Box functionality to Laravel. With Laravel Meta Box, you can define features such as custom fields for posts without the need to create a custom field table in the database.

Installs

Install Package:

composer require rayiumir/laravel-metabox

After Publish Files:

php artisan vendor:publish --provider="Rayiumir\\LaravelMetabox\\ServiceProvider\\MetaboxServiceProvider"

And Migration Database:

php artisan migrate

How to use

Calling HasMetaboxes in Models Post.php:

use Rayiumir\LaravelMetabox\Traits\HasMetaboxes;

use HasMetaboxes;

To delete post metabox data, place the following function in Post.php:

protected static function boot(): void
{
    parent::boot();

    static::deleting(function ($post) {
        $post->metaboxes()->delete();
    });
}

Task Laravel Metabox

  • Text Field
  • Upload Field
  • Select Field
  • Checkbox Field
  • Radio ‌Button Field
  • Tabs Field
  • Gallery Image Field