PHPackages                             ahmet/laravel-flag-system - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. ahmet/laravel-flag-system

AbandonedArchivedLibrary[Database &amp; ORM](/categories/database)

ahmet/laravel-flag-system
=========================

Add flag(s) to database and manage them.

36[1 issues](https://github.com/ahmetcelikezer/laravel-flag-system/issues)PHP

Since Dec 28Pushed 7y agoCompare

[ Source](https://github.com/ahmetcelikezer/laravel-flag-system)[ Packagist](https://packagist.org/packages/ahmet/laravel-flag-system)[ RSS](/packages/ahmet-laravel-flag-system/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (4)Used By (0)

Laravel Flag System - Development Test
======================================

[](#laravel-flag-system---development-test)

[![CircleCI](https://camo.githubusercontent.com/1eb4872031b929c4457b9ea0bcf650474d8090f365d23448c36374ae43bc42c3/68747470733a2f2f636972636c6563692e636f6d2f67682f61686d657463656c696b657a65722f6c61726176656c2d666c61672d73797374656d2f747265652f6d61737465722e7376673f7374796c653d737667)](https://circleci.com/gh/ahmetcelikezer/laravel-flag-system/tree/master)[![Version](https://camo.githubusercontent.com/4caf8a4c27fcbf4d442e25448e5656c543e5557927a8161309759ec2d57e8e08/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76657273696f6e2d616c7068612d6f72616e67652e737667)](https://camo.githubusercontent.com/4caf8a4c27fcbf4d442e25448e5656c543e5557927a8161309759ec2d57e8e08/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76657273696f6e2d616c7068612d6f72616e67652e737667)[![Version](https://camo.githubusercontent.com/6d361c9ba94a15a81a862ddd3f3b9fa5409406d69d5c836986f170fd6985fcbf/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f757361626c652d6e6f7425323072656164792d7265642e737667)](https://camo.githubusercontent.com/6d361c9ba94a15a81a862ddd3f3b9fa5409406d69d5c836986f170fd6985fcbf/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f757361626c652d6e6f7425323072656164792d7265642e737667)

> NOTE: Project is not ready to launch! Stable Version 1.0 will be released soon.

- [Installation](#Installation)
- [How to use](#how-to-use)
    - [Creating Flag](#creating-a-new-flag)
        - [Single Creation](#single-creation)
        - [Multiple Creation](#multiple-creation)
    - [Update Flag Title](#updating-flag-name)
        - [Update By Title](#by-flag-title)
        - [Update By ID](#by-flag-id)
    - [Remove Flag](#remove-flag)
        - [Remove by Title](#remove-flag-by-title)
        - [Remove by ID](#remove-flag-by-id)
    - [Flag Relations](#flag-relations)
        - [Add Flag to Data](#add-flag-to-data)
            - [Add Flag to Data by Title](#add-flag-to-data-by-title)
            - [Add Flag to Data by ID](#add-flag-to-data-by-id)
            - [Add Multiple Flag to Data](#add-multiple-flags-to-data)
    - [Disconnect Flag](#disconnect-flag)
        - [Disconnect By Title](#disconnect-by-flag-title)
        - [Disconnect All By Title](#disconnect-all-by-title)
        - [Disconnect By ID](#disconnect-by-flag-id)
        - [Disconnect All By ID](#disconnect-all-by-id)
    - [Controls](#controls)
        - [Query Data for Specific Flag](#query-data-for-specific-flag)

Installation
------------

[](#installation)

Add laravel-flag-system to your composer.json using this command bellow:

```
$ composer require ahmetcelikezer/laravel-flag-system
```

Next if you are using Laravel 5.5 or newer version, Laravel Package Auto-Discovery will add this service provider automaticly.

If you are using Laravel 5.4 or older version, you must add provider manually. Use the steps bellow:

- Go to /config/app.php
- Add ahmetcelikezer\\laravelFlagSystem\\FlagSystemServiceProvider::class, to 'providers' array

> Warning: Default table names are : "flags", "flag\_relations", if you already created any table with one of theese names, you can change the table names on package\_location/src/config.php

Right after, the package needs to create it's own migrations, so you must use Laravel's migrate command like bellow

```
$ php artisan migrate
```

---

How to Use
----------

[](#how-to-use)

Let's give an axample to better explain: For make easy to understand this package, we have an imaginary project which is based on e-commerce app. Now we will learn how to use this package on this project.

#### Creating a new Flag

[](#creating-a-new-flag)

Creating a new flag is means like creating a rule or category or anything based on your imagination. And any table and it's record on your app's database can have one or more flags.

##### Single Creation

[](#single-creation)

> Note: All flag names are automatically will be lowercased and trimmed right before the insert by the system.

We want to crate "discount" flag to use with our products, so our code is will be similar this:

```
