Skip to content

Commit 57f2216

Browse files
committed
wip
1 parent b6229a7 commit 57f2216

File tree

7 files changed

+157
-3
lines changed

7 files changed

+157
-3
lines changed

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
; This file is for unifying the coding style for different editors and IDEs.
2+
; More information at http://editorconfig.org
3+
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
indent_size = 4
9+
indent_style = space
10+
end_of_line = lf
11+
insert_final_newline = true
12+
trim_trailing_whitespace = true
13+
14+
[*.md]
15+
trim_trailing_whitespace = false

.gitattributes

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/.github export-ignore
2+
/tests export-ignore
3+
/.editorconfig export-ignore
4+
/.gitattributes export-ignore
5+
/.gitignore export-ignore
6+
/CHANGELOG.md export-ignore
7+
/CONTRIBUTING.md export-ignore

CONTRIBUTING.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Contributing
2+
3+
Contributions are **welcome** and will be fully **credited**.
4+
5+
Please read and understand the contribution guide before creating an issue or pull request.
6+
7+
## Etiquette
8+
9+
This project is open source, and as such, the maintainers give their free time to build and maintain the source code
10+
held within. They make the code freely available in the hope that it will be of use to other developers. It would be
11+
extremely unfair for them to suffer abuse or anger for their hard work.
12+
13+
Please be considerate towards maintainers when raising issues or presenting pull requests. Let's show the
14+
world that developers are civilized and selfless people.
15+
16+
It's the duty of the maintainer to ensure that all submissions to the project are of sufficient
17+
quality to benefit the project. Many developers have different skillsets, strengths, and weaknesses. Respect the maintainer's decision, and do not be upset or abusive if your submission is not used.
18+
19+
## Viability
20+
21+
When requesting or submitting new features, first consider whether it might be useful to others. Open
22+
source projects are used by many developers, who may have entirely different needs to your own. Think about
23+
whether or not your feature is likely to be used by other users of the project.
24+
25+
## Procedure
26+
27+
Before filing an issue:
28+
29+
- Attempt to replicate the problem, to ensure that it wasn't a coincidental incident.
30+
- Check to make sure your feature suggestion isn't already present within the project.
31+
- Check the pull requests tab to ensure that the bug doesn't have a fix in progress.
32+
- Check the pull requests tab to ensure that the feature isn't already in progress.
33+
34+
Before submitting a pull request:
35+
36+
- Check the codebase to ensure that your feature doesn't already exist.
37+
- Check the pull requests to ensure that another person hasn't already submitted the feature or fix.
38+
39+
## Requirements
40+
41+
If the project maintainer has any additional requirements, you will find them listed here.
42+
43+
- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](https://pear.php.net/package/PHP_CodeSniffer).
44+
45+
- **Add tests!** - Your patch won't be accepted if it doesn't have tests.
46+
47+
- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.
48+
49+
- **Consider our release cycle** - We try to follow [SemVer v2.0.0](https://semver.org/). Randomly breaking public APIs is not an option.
50+
51+
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
52+
53+
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](https://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting.
54+
55+
**Happy coding**!

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) Semih ERDOGAN
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,57 @@
11
# Laravel Eloquent Filters
22

3-
Create eloquent filters easily
3+
Create and use eloquent filters easily.
4+
5+
# Installation
6+
7+
You can install the package via composer:
8+
9+
```bash
10+
$ composer require laratoolbox/database-viewer
11+
```
12+
13+
# Usage
14+
15+
First create filter like below.
416

517
```shell
618
php artisan make:filter UserFilter
719
```
20+
21+
After creating the filter, add Filter trait into your eloquent model.
22+
23+
```php
24+
use \LaraToolbox\EloquentFilters\Traits\Filters;
25+
```
26+
27+
Then you may use filter like below.
28+
29+
```php
30+
MyEloquentModel::filter( new UserFilter(request()) )->get();
31+
```
32+
33+
# Testing
34+
35+
// TODO:
36+
37+
# Changelog
38+
39+
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
40+
41+
# Contributing
42+
43+
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
44+
45+
# Security
46+
47+
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
48+
49+
Credits
50+
51+
- [Semih ERDOGAN](https://github.com/laratoolbox)
52+
- [Dincer DEMIRCIOGLU](https://github.com/dinncer)
53+
- [All contributors](https://github.com/laratoolbox/database-viewer/graphs/contributors)
54+
55+
# License
56+
57+
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

src/Commands/MakeFilter.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function handle()
4848
config('eloquent_filters.namespace', 'App\Filters'),
4949
$filterClass,
5050
],
51-
file_get_contents('../stub/filter.stub') // TODO: make stub customizable
51+
$this->getStub()
5252
);
5353

5454
file_put_contents(
@@ -59,4 +59,10 @@ public function handle()
5959
$this->info('Filter created.');
6060
return 0;
6161
}
62+
63+
private function getStub()
64+
{
65+
// TODO: make stub customizable
66+
return '<?php'.PHP_EOL.PHP_EOL.file_get_contents('../stub/filter.stub');
67+
}
6268
}

src/PackageServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Illuminate\Support\ServiceProvider;
66
use LaraToolbox\EloquentFilters\Commands\MakeFilter;
77

8-
class DatabaseViewerServiceProvider extends ServiceProvider
8+
class PackageServiceProvider extends ServiceProvider
99
{
1010
/**
1111
* Bootstrap the application services.

0 commit comments

Comments
 (0)