Skip to content

Commit ba0cde9

Browse files
committed
Initial commit
1 parent 35a7fb8 commit ba0cde9

20 files changed

+831
-3
lines changed

.gitattributes

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
* text=auto
2+
3+
/tests export-ignore
4+
/.gitattributes export-ignore
5+
/.gitignore export-ignore
6+
/.php_cs export-ignore
7+
/CODE_OF_CONDUCT.md export-ignore
8+
/CONTRIBUTING.md export-ignore
9+
/phpunit.xml.dist export-ignore

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
vendor/
2+
.php_cs.cache
3+
composer.lock
4+
composer.phar
5+
phpunit.xml

.php_cs

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?php
2+
3+
$finder = Symfony\Component\Finder\Finder::create()
4+
->notPath('bootstrap/cache')
5+
->notPath('storage')
6+
->notPath('vendor')
7+
->in(__DIR__)
8+
->name('*.php')
9+
->ignoreDotFiles(true)
10+
->ignoreVCS(true);
11+
12+
$fixers = [
13+
'-psr0',
14+
'-php_closing_tag',
15+
'blankline_after_open_tag',
16+
'-concat_without_spaces',
17+
'double_arrow_multiline_whitespaces',
18+
'duplicate_semicolon',
19+
'empty_return',
20+
'extra_empty_lines',
21+
'include',
22+
'join_function',
23+
'list_commas',
24+
'multiline_array_trailing_comma',
25+
'namespace_no_leading_whitespace',
26+
'newline_after_open_tag',
27+
'no_blank_lines_after_class_opening',
28+
'no_empty_lines_after_phpdocs',
29+
'object_operator',
30+
'operators_spaces',
31+
'phpdoc_indent',
32+
'phpdoc_no_access',
33+
'-phpdoc_no_package',
34+
'phpdoc_scalar',
35+
'phpdoc_short_description',
36+
'phpdoc_to_comment',
37+
'phpdoc_trim',
38+
'phpdoc_type_to_var',
39+
'phpdoc_var_without_name',
40+
'remove_leading_slash_use',
41+
'remove_lines_between_uses',
42+
'return',
43+
'self_accessor',
44+
'single_array_no_trailing_comma',
45+
'single_blank_line_before_namespace',
46+
'single_quote',
47+
'spaces_before_semicolon',
48+
'spaces_cast',
49+
'standardize_not_equal',
50+
'ternary_spaces',
51+
'trim_array_spaces',
52+
'unalign_equals',
53+
'unary_operators_spaces',
54+
'whitespacy_lines',
55+
'multiline_spaces_before_semicolon',
56+
'short_array_syntax',
57+
'short_echo_tag',
58+
];
59+
60+
return Symfony\CS\Config\Config::create()
61+
->level(Symfony\CS\FixerInterface::PSR2_LEVEL)
62+
->fixers($fixers)
63+
->finder($finder)
64+
->setUsingCache(true);

.styleci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
preset: laravel
2+
3+
disabled:
4+
- concat_without_spaces
5+
- phpdoc_no_package
6+
- logical_not_operators_with_successor_space

.travis.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
language: php
2+
3+
php:
4+
- 5.6
5+
- 7.0
6+
- 7.1
7+
8+
before_script:
9+
- travis_retry composer self-update
10+
- travis_retry composer install --no-interaction
11+
12+
script: vendor/bin/phpunit --verbose

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Changelog
2+
3+
All notable changes to `laravel-eloquent-flag` will be documented in this file.
4+
5+
## 1.0.0 - 2016-09-25
6+
7+
- Initial release

CODE_OF_CONDUCT.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to making participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, gender identity and expression, level of experience,
9+
nationality, personal appearance, race, religion, or sexual identity and
10+
orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies both within project spaces and in public spaces
49+
when an individual is representing the project or its community. Examples of
50+
representing a project or community include using an official project e-mail
51+
address, posting via an official social media account, or acting as an appointed
52+
representative at an online or offline event. Representation of a project may be
53+
further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team at [email protected]. All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project team is
61+
obligated to maintain confidentiality with regard to the reporter of an incident.
62+
Further details of specific enforcement policies may be posted separately.
63+
64+
Project maintainers who do not follow or enforce the Code of Conduct in good
65+
faith may face temporary or permanent repercussions as determined by other
66+
members of the project's leadership.
67+
68+
## Attribution
69+
70+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71+
available at [http://contributor-covenant.org/version/1/4][version]
72+
73+
[homepage]: http://contributor-covenant.org
74+
[version]: http://contributor-covenant.org/version/1/4/

CONTRIBUTING.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Contributing to Laravel Eloquent Flag
2+
3+
Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
4+
5+
## Workflow
6+
7+
- Fork the project.
8+
- Make your bug fix or feature addition.
9+
- Add tests for it. This is important so we don't break it in a future version unintentionally.
10+
- Send a pull request. Bonus points for topic branches.
11+
12+
Please make sure that you have [set up your user name and email address](http://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup) for use with Git.
13+
14+
Pull requests for bug fixes must be based on the current stable branch.
15+
16+
We are trying to keep backwards compatibility breaks in Laravel Eloquent Flag to an absolute minimum. Please take this into account when proposing changes.
17+
18+
Due to time constraints, we are not always able to respond as quickly as we would like. Please do not take delays personal and feel free to remind us if you feel that we forgot to respond.
19+
20+
## Coding Guidelines
21+
22+
This project comes with a configuration file for php-cs-fixer (.php_cs) that you can use to (re)format your sourcecode for compliance with this project's coding guidelines:
23+
24+
```shell
25+
vendor/bin/php-cs-fixer fix
26+
```
27+
28+
## PHPUnit tests
29+
30+
The phpunit script can be used to invoke the PHPUnit test runner:
31+
32+
```shell
33+
vendor/bin/phpunit
34+
```
35+
36+
## Reporting issues
37+
38+
- [General problems](https://github.com/a-komarev/laravel-eloquent-flag/issues)

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2016 Pe Ell
3+
Copyright (c) 2016, CyberCog LLC (http://cybercog.ru).
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 76 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,76 @@
1-
# laravel-eloquent-flag
2-
Eloquent flaggable attributes behavior
1+
# Laravel Eloquent Flag
2+
3+
[![Build Status](https://img.shields.io/travis/cybercog/laravel-eloquent-flag/master.svg?style=flat-square)](https://travis-ci.org/cybercog/laravel-eloquent-flag)
4+
[![StyleCI](https://styleci.io/repos/69245607/shield)](https://styleci.io/repos/69245607)
5+
[![Releases](https://img.shields.io/github/release/cybercog/laravel-eloquent-flag.svg?style=flat-square)](https://github.com/cybercog/laravel-eloquent-flag/releases)
6+
[![License](https://img.shields.io/github/license/cybercog/laravel-eloquent-flag.svg?style=flat-square)](https://github.com/cybercog/laravel-eloquent-flag/blob/master/LICENSE)
7+
8+
Eloquent flagged attributes behavior.
9+
10+
## Flags list
11+
12+
- Is Active
13+
- Is Published (todo)
14+
- Is Confirmed (todo)
15+
16+
## Installation
17+
18+
First, pull in the package through Composer.
19+
20+
```shell
21+
composer require cybercog/laravel-eloquent-flag
22+
```
23+
24+
And then include the service provider within `app/config/app.php`.
25+
26+
```php
27+
'providers' => [
28+
Cog\Flag\Providers\FlagServiceProvider::class,
29+
];
30+
```
31+
32+
## Setup a Model
33+
34+
```php
35+
<?php
36+
37+
namespace App\Models;
38+
39+
use Cog\Flag\Traits\HasActiveFlag;
40+
use Illuminate\Database\Eloquent\Model;
41+
42+
class Post extends Model
43+
{
44+
use HasActiveFlag;
45+
}
46+
```
47+
48+
## Testing
49+
50+
Run the tests with:
51+
52+
```shell
53+
vendor/bin/phpunit
54+
```
55+
56+
## Contributing
57+
58+
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
59+
60+
## Security
61+
62+
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
63+
64+
## Credits
65+
66+
- [Anton Komarev](https://github.com/a-komarev)
67+
68+
## License
69+
70+
Please see [License](LICENSE) file for more information.
71+
72+
## About CyberCog
73+
74+
[CyberCog](http://www.cybercog.ru) is a Social Unity of enthusiasts. Research best solutions in product & software development is our passion.
75+
76+
![cybercog-logo](https://cloud.githubusercontent.com/assets/1849174/18418932/e9edb390-7860-11e6-8a43-aa3fad524664.png)

composer.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "cybercog/laravel-eloquent-flag",
3+
"description": "Laravel Eloquent flagged attributes behavior",
4+
"authors": [
5+
{
6+
"name": "Anton Komarev",
7+
"email": "[email protected]",
8+
"homepage": "http://ell.folio.su",
9+
"role": "Developer"
10+
}
11+
],
12+
"license": "MIT",
13+
"type": "library",
14+
"require": {
15+
"php": "^5.6|^7.0",
16+
"illuminate/database": "~5.2.0|~5.3.0"
17+
},
18+
"require-dev": {
19+
"friendsofphp/php-cs-fixer": "^1.11",
20+
"phpunit/phpunit": "^5.2",
21+
"orchestra/testbench": "~3.0",
22+
"mockery/mockery": "^0.9.5"
23+
},
24+
"autoload": {
25+
"psr-4": {
26+
"Cog\\Flag\\": "src/"
27+
}
28+
},
29+
"autoload-dev": {
30+
"psr-4": {
31+
"Cog\\Flag\\Tests\\": "tests/"
32+
}
33+
}
34+
}

phpunit.xml.dist

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit backupGlobals="false"
3+
backupStaticAttributes="false"
4+
bootstrap="vendor/autoload.php"
5+
colors="true"
6+
convertErrorsToExceptions="true"
7+
convertNoticesToExceptions="true"
8+
convertWarningsToExceptions="true"
9+
processIsolation="false"
10+
stopOnFailure="false"
11+
syntaxCheck="false"
12+
verbose="true"
13+
>
14+
<testsuites>
15+
<testsuite name="Package Test Suite">
16+
<directory suffix=".php">tests/</directory>
17+
<exclude>tests/database/factories/</exclude>
18+
</testsuite>
19+
</testsuites>
20+
<php>
21+
<env name="APP_ENV" value="testing"/>
22+
<env name="CACHE_DRIVER" value="array"/>
23+
<env name="SESSION_DRIVER" value="array"/>
24+
<env name="QUEUE_DRIVER" value="sync"/>
25+
<env name="DB_CONNECTION" value="sqlite"/>
26+
<env name="DB_DATABASE" value=":memory:"/>
27+
</php>
28+
</phpunit>

src/Providers/FlagServiceProvider.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
/*
4+
* This file is part of Laravel Eloquent Flag.
5+
*
6+
* (c) CyberCog <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Cog\Flag\Providers;
13+
14+
use Illuminate\Support\ServiceProvider;
15+
16+
/**
17+
* Class FlagServiceProvider.
18+
*
19+
* @package Cog\Flag\Scopes
20+
*/
21+
class FlagServiceProvider extends ServiceProvider
22+
{
23+
// :TODO: Register console commands to create migrations from stubs
24+
}

0 commit comments

Comments
 (0)