Skip to content

Auto-expiring tags with additional payload data on any eloquent model.

Notifications You must be signed in to change notification settings

w74anheda/TempTag

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel TempTag

Auto-expiring tags with additional payload data on any eloquent model.

Installation

first you need to install and configure mongodb in your laravel project with jenssegers/laravel-mongodb, then install package m74asoud/temptag with below command

composer require m74asoud/temptag

migrate table

php artisan migrate

Configure Model

use M74asoud\TempTag\Traits\TempTagAble;

class User extend Model {
  use TempTagAble;
  protected $connection = 'mysql';
  protected $table = 'users';
}

Usage

$user->tempTagService()
->tagIt(
  string $title,
  $payload = null,
  Carbon $expire_at = null
): TempTag


$user->tempTagService()->unTag(string $title)
$user->tempTagService()->unTagID($ID)
$user->tempTagService()->get(string  $title): EloquentCollection
$user->tempTagService()->getOne(string  $title): ?TempTag
$user->tempTagService()->getOneID($ID): ?TempTag
$user->tempTagService()->all(): EloquentCollection
... and another method,complete readme file comming soon

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

About

Auto-expiring tags with additional payload data on any eloquent model.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages