Add bullet points to Laravel 5.1 Eloquent models.

1.0.0 2016-04-27 20:47 UTC

This package is not auto-updated.

Last update: 2024-06-08 16:43:24 UTC


This package allows you to attach bullet points to an Eloquent model in Laravel 5.

Composer Install

It can be found on Packagist. The recommended way is through composer.

Edit composer.json and add:

    "require": {
        "craigzearfoss/bullets": "dev-master"

And install dependencies:

$ composer update

If you do not have Composer installed, run these two commands:

$ curl -sS | php
$ php composer.phar install

Install and then Run the migrations

Find the providers array key in config/app.php and register the Bullets Service Provider.

'providers' => array(
    // ...


Run the migration to create the bullets table.

php artisan vendor:publish --provider="Craigzearfoss\Bullets\Providers\BulletsServiceProvider"
php artisan migrate


In your model add the BulletableTrait.


// ...
use Craigzearfoss\Bullets\BulletableTrait;

class MyModel extends Model
    use BulletableTrait;


To fetch the bullets for your model:

$bullets = $myModel->bullets()->get();

To sync the bullets for your model when storing or updating:

$myModel->syncBullets(isset($data['bullet_list']) ? $data['bullet_list'] : []);

To add the bullets for your model to you forms blade templates:

  1. Add the form select element.
<div class="form-group">
    {!! Form::label('bullet_list', 'Bullet Points:') !!}
   {!! Form::select('bullet_list[]', $myModel->bullets()->lists('comment', 'comment')->toArray(), array_keys($myModel->bullets()->lists('comment', 'comment')->toArray()), ['id' => 'bullet_list', 'class' => 'form-control select2-bullet-list', 'multiple']) !!}
  1. Add select.js to your layout.
<script type="text/javascript" src="js/select2.min.js"></script>
  1. Add the following to your css for the form element. This makes the bullet select list items have a width of 100%.
.select2-bullet-list + .select2-container--default .select2-selection--multiple .select2-selection__choice {
    width: 100%;
4. Add the following JavaScript to the form page.
<script type="text/javascript">
        placeholder: "Add Bullet Points",
        tags: true,
        tokenSeparators: ["\n"],
        maximumSelectionLength: 255
  • To display the bullets for your model in a blade template:
@if (!empty($bullets))
        @foreach($bullets as $bullet)
            <li>{{ $bullet->comment }}</li>


See the CHANGELOG file


Please open an issue on GitHub

Contributor Code of Conduct

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.


Bullets is released under the MIT License. See the bundled LICENSE file for details.