Skip to content
This repository has been archived by the owner on Feb 16, 2022. It is now read-only.

Commit

Permalink
Merge branch 'release/v0.0.4'
Browse files Browse the repository at this point in the history
* release/v0.0.4: (56 commits)
  Update changelog
  Drop Laravel 5.5 support
  Update composer packages
  Update composer packages
  Apply fixes from StyleCI
  Check if attribute_entity database table exists before querying entity attributes
  Return eloquent collection always from getEntityAttributes method for compatibility
  Add force option to artisan commands
  Simplify IoC binding
  Update minimum required PHP version
  Add Laravel v5.6 support
  Sort attributes on retrieval
  Drop useless model contracts (models already swappable through IoC)
  Typehint method returns
  Typehint void method returns
  Fixed #30
  Fix entity custom primary id issue (fix #30, #26)
  Fix documentation code smaple
  Remove fillable relation rules
  Fix entities issue and tweak some features
  ...
  • Loading branch information
Omranic committed Feb 18, 2018
2 parents 338f767 + cd9be2e commit 18945f6
Show file tree
Hide file tree
Showing 34 changed files with 399 additions and 314 deletions.
9 changes: 5 additions & 4 deletions .gitattributes
@@ -1,8 +1,9 @@
* text=auto
*.js linguist-vendored
*.css linguist-vendored
*.scss linguist-vendored

phpunit.* export-ignore
phpcs.* export-ignore
tests export-ignore
.* export-ignore
/phpunit.* export-ignore
/phpcs.* export-ignore
/tests export-ignore
/.* export-ignore
49 changes: 31 additions & 18 deletions .styleci.yml
@@ -1,20 +1,33 @@
preset: recommended
php:
preset: recommended

enabled:
- dir_constant
- ereg_to_preg
- mb_str_functions
- no_short_echo_tag
- strict_comparison
- phpdoc_link_to_see
- no_php4_constructor
- declare_strict_types
- unalign_double_arrow
- length_ordered_imports
- modernize_types_casting
- return_type_declaration
- not_operator_with_successor_space
enabled:
- dir_constant
- ereg_to_preg
- mb_str_functions
- no_short_echo_tag
- strict_comparison
- phpdoc_link_to_see
- no_php4_constructor
- declare_strict_types
- unalign_double_arrow
- length_ordered_imports
- modernize_types_casting
- return_type_declaration
- not_operator_with_successor_space

disabled:
- align_double_arrow
- alpha_ordered_imports
disabled:
- align_double_arrow
- alpha_ordered_imports

js:
tab-width: 4
print-width: 120

ts:
tab-width: 4
print-width: 120

css:
tab-width: 4
print-width: 120
32 changes: 32 additions & 0 deletions CHANGELOG.md
Expand Up @@ -5,6 +5,37 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](CONTRIBUTING.md).


## [v0.0.4] - 2018-02-18
- Update composer dependencies
- Update supplementary files
- Tweak setEntitiesAttribute mutator
- Add PublishCommand to artisan
- Move slug auto generation to the custom HasSlug trait
- Add missing composer dependencies
- GetMorphClass the right way
- Remove useless scopes
- Fix polymorphic class maps
- Register blade extension for @attributes
- Refactor attribute types registration
- Fix attributable cache issues
- Add PHPUnitPrettyResultPrinter
- Add slug unique index
- Move frontend stuff to cortex/attributes from rinvex/attributes
- Tweak and fix entity attributes retrieval
- Require PHP v7.1.3
- Fix entities issue and tweak some features
- Remove fillable relation rules
- Fix entity custom primary id issue (fix #30, #26)
- Typehint method returns
- Drop useless model contracts (models already swappable through IoC)
- Sort attributes on retrieval
- Add Laravel v5.6 support
- Simplify IoC binding
- Add force option to artisan commands
- Return eloquent collection always from getEntityAttributes method for compatibility
- Check if attribute_entity database table exists before querying entity attributes
- Drop Laravel 5.5 support

## [v0.0.3] - 2017-09-09
- Fix many issues and apply many enhancements
- Rename package rinvex/attributes from rinvex/attributable
Expand All @@ -25,5 +56,6 @@ This project adheres to [Semantic Versioning](CONTRIBUTING.md).
## v0.0.1 - 2017-04-08
- Rename package to "rinvex/attributable" from "rinvex/sparse" based on 715a831

[v0.0.4]: https://github.com/rinvex/attributes/compare/v0.0.3...v0.0.4
[v0.0.3]: https://github.com/rinvex/attributes/compare/v0.0.2...v0.0.3
[v0.0.2]: https://github.com/rinvex/attributes/compare/v0.0.1...v0.0.2
2 changes: 1 addition & 1 deletion LICENSE
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2016-2017, Rinvex LLC,
Copyright (c) 2016-2018, Rinvex LLC,

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
126 changes: 77 additions & 49 deletions README.md

Large diffs are not rendered by default.

23 changes: 13 additions & 10 deletions composer.json
Expand Up @@ -47,19 +47,22 @@
}
],
"require": {
"php": "^7.0.0",
"illuminate/support": "~5.5.0",
"illuminate/database": "~5.5.0",
"spatie/laravel-sluggable": "^2.0.0",
"spatie/eloquent-sortable": "^3.4.0",
"spatie/laravel-translatable": "^2.0.0",
"php": "^7.1.3",
"illuminate/console": "~5.6.0",
"illuminate/database": "~5.6.0",
"illuminate/support": "~5.6.0",
"jeremeamia/superclosure": "^2.3.0",
"rinvex/cacheable": "dev-develop",
"watson/validating": "^3.0.1"
"rinvex/support": "dev-develop",
"spatie/eloquent-sortable": "^3.4.0",
"spatie/laravel-sluggable": "^2.1.0",
"spatie/laravel-translatable": "^2.1.0",
"watson/validating": "^3.1.0"
},
"require-dev": {
"phpunit/phpunit": "^6.0.0",
"illuminate/container": "~5.5.0"
"codedungeon/phpunit-result-printer": "^0.6.0",
"illuminate/container": "~5.6.0",
"phpunit/phpunit": "^7.0.0"
},
"autoload": {
"classmap": [
Expand All @@ -75,8 +78,8 @@
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"preferred-install": "dist",
"optimize-autoloader": true
},
"extra": {
Expand Down
Expand Up @@ -13,7 +13,7 @@ class CreateAttributesTable extends Migration
*
* @return void
*/
public function up()
public function up(): void
{
Schema::create(config('rinvex.attributes.tables.attributes'), function (Blueprint $table) {
// Columns
Expand All @@ -28,6 +28,9 @@ public function up()
$table->boolean('is_collection')->default(false);
$table->text('default')->nullable();
$table->timestamps();

// Indexes
$table->unique('slug');
});
}

Expand All @@ -36,7 +39,7 @@ public function up()
*
* @return void
*/
public function down()
public function down(): void
{
Schema::dropIfExists(config('rinvex.attributes.tables.attributes'));
}
Expand All @@ -46,7 +49,7 @@ public function down()
*
* @return string
*/
protected function jsonable()
protected function jsonable(): string
{
return DB::connection()->getPdo()->getAttribute(PDO::ATTR_DRIVER_NAME) === 'mysql'
&& version_compare(DB::connection()->getPdo()->getAttribute(PDO::ATTR_SERVER_VERSION), '5.7.8', 'ge')
Expand Down
Expand Up @@ -13,7 +13,7 @@ class CreateAttributeBooleanValuesTable extends Migration
*
* @return void
*/
public function up()
public function up(): void
{
Schema::create(config('rinvex.attributes.tables.attribute_boolean_values'), function (Blueprint $table) {
// Columns
Expand All @@ -35,7 +35,7 @@ public function up()
*
* @return void
*/
public function down()
public function down(): void
{
Schema::dropIfExists(config('rinvex.attributes.tables.attribute_boolean_values'));
}
Expand Down
Expand Up @@ -13,7 +13,7 @@ class CreateAttributeDateTimeValuesTable extends Migration
*
* @return void
*/
public function up()
public function up(): void
{
Schema::create(config('rinvex.attributes.tables.attribute_datetime_values'), function (Blueprint $table) {
// Columns
Expand All @@ -35,7 +35,7 @@ public function up()
*
* @return void
*/
public function down()
public function down(): void
{
Schema::dropIfExists(config('rinvex.attributes.tables.attribute_datetime_values'));
}
Expand Down
Expand Up @@ -13,7 +13,7 @@ class CreateAttributeIntegerValuesTable extends Migration
*
* @return void
*/
public function up()
public function up(): void
{
Schema::create(config('rinvex.attributes.tables.attribute_integer_values'), function (Blueprint $table) {
// Columns
Expand All @@ -35,7 +35,7 @@ public function up()
*
* @return void
*/
public function down()
public function down(): void
{
Schema::dropIfExists(config('rinvex.attributes.tables.attribute_integer_values'));
}
Expand Down
Expand Up @@ -13,7 +13,7 @@ class CreateAttributeVarcharValuesTable extends Migration
*
* @return void
*/
public function up()
public function up(): void
{
Schema::create(config('rinvex.attributes.tables.attribute_varchar_values'), function (Blueprint $table) {
// Columns
Expand All @@ -35,7 +35,7 @@ public function up()
*
* @return void
*/
public function down()
public function down(): void
{
Schema::dropIfExists(config('rinvex.attributes.tables.attribute_varchar_values'));
}
Expand Down
Expand Up @@ -13,7 +13,7 @@ class CreateAttributeEntityTable extends Migration
*
* @return void
*/
public function up()
public function up(): void
{
Schema::create(config('rinvex.attributes.tables.attribute_entity'), function (Blueprint $table) {
// Columns
Expand All @@ -33,7 +33,7 @@ public function up()
*
* @return void
*/
public function down()
public function down(): void
{
Schema::dropIfExists(config('rinvex.attributes.tables.attribute_entity'));
}
Expand Down
Expand Up @@ -13,7 +13,7 @@ class CreateAttributeTextValuesTable extends Migration
*
* @return void
*/
public function up()
public function up(): void
{
Schema::create(config('rinvex.attributes.tables.attribute_text_values'), function (Blueprint $table) {
// Columns
Expand All @@ -35,7 +35,7 @@ public function up()
*
* @return void
*/
public function down()
public function down(): void
{
Schema::dropIfExists(config('rinvex.attributes.tables.attribute_text_values'));
}
Expand Down
13 changes: 7 additions & 6 deletions phpunit.xml.dist
Expand Up @@ -11,7 +11,8 @@
stopOnFailure="false"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutChangesToGlobalState="true"
beStrictAboutCoversAnnotation="true">
beStrictAboutCoversAnnotation="true"
printerClass="Codedungeon\PHPUnitPrettyResultPrinter\Printer">
<testsuites>
<testsuite name="Rinvex Attributes Unit Test Suite">
<directory>tests</directory>
Expand All @@ -23,10 +24,10 @@
</whitelist>
</filter>
<logging>
<log type="tap" target="build/report.tap"/>
<log type="junit" target="build/report.junit.xml"/>
<log type="coverage-html" target="build/coverage" charset="UTF-8" yui="true" highlight="true"/>
<log type="coverage-text" target="build/coverage.txt"/>
<log type="coverage-clover" target="build/logs/clover.xml"/>
<log type="tap" target="build/report.tap" />
<log type="junit" target="build/report.junit.xml" />
<log type="coverage-html" target="build/coverage" charset="UTF-8" yui="true" highlight="true" />
<log type="coverage-text" target="build/coverage.txt" />
<log type="coverage-clover" target="build/logs/clover.xml" />
</logging>
</phpunit>
8 changes: 4 additions & 4 deletions src/Console/Commands/MigrateCommand.php
Expand Up @@ -13,7 +13,7 @@ class MigrateCommand extends Command
*
* @var string
*/
protected $signature = 'rinvex:migrate:attributes';
protected $signature = 'rinvex:migrate:attributes {--force : Force the operation to run when in production.}';

/**
* The console command description.
Expand All @@ -27,9 +27,9 @@ class MigrateCommand extends Command
*
* @return void
*/
public function handle()
public function handle(): void
{
$this->warn('Migrate rinvex/attributes:');
$this->call('migrate', ['--step' => true, '--path' => 'vendor/rinvex/attributes/database/migrations']);
$this->warn($this->description);
$this->call('migrate', ['--step' => true, '--path' => 'vendor/rinvex/attributes/database/migrations', '--force' => $this->option('force')]);
}
}
35 changes: 35 additions & 0 deletions src/Console/Commands/PublishCommand.php
@@ -0,0 +1,35 @@
<?php

declare(strict_types=1);

namespace Rinvex\Attributes\Console\Commands;

use Illuminate\Console\Command;

class PublishCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'rinvex:publish:attributes {--force : Overwrite any existing files.}';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Publish Rinvex Attributes Resources.';

/**
* Execute the console command.
*
* @return void
*/
public function handle(): void
{
$this->warn($this->description);
$this->call('vendor:publish', ['--tag' => 'rinvex-attributes-config', '--force' => $this->option('force')]);
}
}

0 comments on commit 18945f6

Please sign in to comment.