https://github.com/litstack/timeline
https://github.com/litstack/timeline
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/litstack/timeline
- Owner: litstack
- Created: 2021-02-24T09:01:22.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-04-09T14:53:19.000Z (over 4 years ago)
- Last Synced: 2025-01-15T11:10:39.266Z (11 months ago)
- Language: PHP
- Size: 108 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Litstack Timeline
A package to simply add timelines to Crud's in litsatck.
## Setup
1. Install the package via composer:
```shell
composer require litstack/timeline
```
2. Publish and run the migrations:
```shell
php artisan vendor:publish --tag=timeline:migrations
php artisan migrate
```
## Usage
Add the `Timelineable` contract and the `HasTimeline` trait to your Model:
```php
use Litstack\Timeline\Contracts\Timelineable;
use Litstack\Timeline\HasTimeline;
class Post extends Model implements Timelineable
{
use HasTimeline;
}
```
Push a timeline item to your Model:
```php
// Add message to timeline.
$post->addToTimeline('Hello World!')->save();
// With some available options.
$post->addToTimeline('Hello World!')->title('Foo')->showTime()->variant('success')->save();
// Variant danger is available as well.
$post->addToTimeline('Hello World!')->variant('danger')->save();
```
## Show Timeline
In your `CrudConfig`:
```php
public function show($page)
{
$page->timeline();
}
```