Skip to content

Commit 90baf28

Browse files
Merge pull request #13 from Syrian-Open-Source/v1.2.0
V1.2.0
2 parents 067a472 + aebb6d1 commit 90baf28

File tree

9 files changed

+402
-214
lines changed

9 files changed

+402
-214
lines changed

.github/workflows/php.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: PHP Composer
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [ main,v1.2.0 ]
66
pull_request:
7-
branches: [ main ]
7+
branches: [ main,v1.2.0 ]
88

99
jobs:
1010
build:

.php-cs-fixer.cache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"php":"8.1.3","version":"3.7.0","indent":" ","lineEnding":"\n","rules":{"blank_line_after_opening_tag":true,"braces":{"allow_single_line_anonymous_class_with_empty_body":true},"class_definition":{"inline_constructor_arguments":false,"space_before_parenthesis":true},"compact_nullable_typehint":true,"declare_equal_normalize":true,"lowercase_cast":true,"lowercase_static_reference":true,"new_with_braces":true,"no_blank_lines_after_class_opening":true,"no_leading_import_slash":true,"no_whitespace_in_blank_line":true,"ordered_class_elements":{"order":["use_trait"]},"ordered_imports":{"sort_algorithm":"alpha"},"return_type_declaration":true,"short_scalar_cast":true,"single_blank_line_before_namespace":true,"single_trait_insert_per_statement":true,"ternary_operator_spaces":true,"visibility_required":true,"blank_line_after_namespace":true,"constant_case":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"on_multiline":"ensure_fully_multiline","keep_multiple_spaces_after_comma":true},"no_break_comment":true,"no_closing_tag":true,"no_space_around_double_colon":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"encoding":true,"full_opening_tag":true,"array_syntax":{"syntax":"short"},"no_unused_imports":true,"not_operator_with_successor_space":true,"trailing_comma_in_multiline":true,"phpdoc_scalar":true,"unary_operator_spaces":true,"binary_operator_spaces":true,"blank_line_before_statement":{"statements":["break","continue","declare","return","throw","try"]},"phpdoc_single_line_var_spacing":true,"phpdoc_var_without_name":true,"class_attributes_separation":{"elements":{"method":"one"}}},"hashes":{"src\/Abstracts\/RelationalRelationAbstract.php":3299928560,"src\/Classes\/RelationalMetrics.php":842680276,"src\/Interfaces\/RelationalInterface.php":1128215520,"tests\/Unit\/ExampleTest.php":3900274864,"tests\/BaseTest.php":3538535820,"tests\/Feature\/ExampleTest.php":3639981892}}
1+
{"php":"8.1.3","version":"3.7.0","indent":" ","lineEnding":"\n","rules":{"blank_line_after_opening_tag":true,"braces":{"allow_single_line_anonymous_class_with_empty_body":true},"class_definition":{"inline_constructor_arguments":false,"space_before_parenthesis":true},"compact_nullable_typehint":true,"declare_equal_normalize":true,"lowercase_cast":true,"lowercase_static_reference":true,"new_with_braces":true,"no_blank_lines_after_class_opening":true,"no_leading_import_slash":true,"no_whitespace_in_blank_line":true,"ordered_class_elements":{"order":["use_trait"]},"ordered_imports":{"sort_algorithm":"alpha"},"return_type_declaration":true,"short_scalar_cast":true,"single_blank_line_before_namespace":true,"single_trait_insert_per_statement":true,"ternary_operator_spaces":true,"visibility_required":true,"blank_line_after_namespace":true,"constant_case":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"on_multiline":"ensure_fully_multiline","keep_multiple_spaces_after_comma":true},"no_break_comment":true,"no_closing_tag":true,"no_space_around_double_colon":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"encoding":true,"full_opening_tag":true,"array_syntax":{"syntax":"short"},"no_unused_imports":true,"not_operator_with_successor_space":true,"trailing_comma_in_multiline":true,"phpdoc_scalar":true,"unary_operator_spaces":true,"binary_operator_spaces":true,"blank_line_before_statement":{"statements":["break","continue","declare","return","throw","try"]},"phpdoc_single_line_var_spacing":true,"phpdoc_var_without_name":true,"class_attributes_separation":{"elements":{"method":"one"}}},"hashes":{"src\/Abstracts\/RelationalRelationAbstract.php":2085162138,"src\/Classes\/RelationalMetrics.php":3212978355,"src\/Interfaces\/RelationalInterface.php":1128215520,"tests\/Unit\/ExampleTest.php":3900274864,"tests\/BaseTest.php":3538535820,"tests\/Feature\/ExampleTest.php":3639981892,"src\/Facades\/RelationalMetricsFacade.php":775496722,"src\/Providers\/RelationalMetricsServiceProviders.php":969866632}}

README.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@ composer require syrian-open-source/laravel-relational-metrics
2020

2121
Usage
2222
---------
23+
```php
24+
// first you must make a model from facade class
25+
// like post model
26+
$instance = \SOS\RelationalMetrics\Facades\RelationalMetricsFacade::setModel("Post");
27+
// or you can specify thr model name by this way: RelationalMetricsFacade::setModel(Store::class);
28+
```
2329
The Basic Usage of this package is the same of getting count of some model instances, but with a styled response
2430

2531
```php
26-
$instance = (new \SOS\RelationalMetrics\Classes\RelationalMetrics("ModelName"));
27-
// example: (new \SOS\RelationalMetrics\Classes\RelationalMetrics("Store"));
28-
// or you can specify thr model name by this way: new RelationalMetrics(Store::class);
2932
$metrics = $instance->getBasicMetrics();
3033
// or you can get the count or the message directly.
3134
$directCount = $instance->getCount();
@@ -45,9 +48,6 @@ What you can do next, you could get the metrics of a model depending on one of i
4548
Let's assume we want to get the number of stores that has products with price more than 500
4649

4750
```php
48-
$instance = (new \SOS\RelationalMetrics\Classes\RelationalMetrics("ModelName"));
49-
// example: (new \SOS\RelationalMetrics\Classes\RelationalMetrics("Store"));
50-
// or you can specify thr model name by this way: new RelationalMetrics(Store::class);
5151
$metrics = $instance->getRelationalMetrics($relationName, $relationColumn, $value);
5252
// example: $instance->getRelationalMetrics('products, 'price', 500);
5353
/*
@@ -66,9 +66,6 @@ And last but not least, You could get the metrics about a model depending on any
6666

6767

6868
```php
69-
$instance = (new \SOS\RelationalMetrics\Classes\RelationalMetrics("ModelName"));
70-
// example: (new \SOS\RelationalMetrics\Classes\RelationalMetrics("Store"));
71-
// or you can specify thr model name by this way: new RelationalMetrics(Store::class);
7269
// example for the conditions
7370
$conditions = [
7471
['method' => 'where', 'column' => 'address', 'operator' => 'like', 'value' => '%UAE%'],

composer.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@
3333
"SOS\\RelationalMetrics\\Tests\\": "src/tests"
3434
}
3535
},
36+
"extra" : {
37+
"laravel" : {
38+
"providers" : [
39+
"SOS\\RelationalMetrics\\Providers\\RelationalMetricsServiceProviders"
40+
]
41+
}
42+
},
3643
"scripts": {
3744
"test": "vendor/bin/phpunit",
3845
"test-coverage": "phpunit --coverage-html coverage",

0 commit comments

Comments
 (0)