Skip to content

Releases: RonasIT/laravel-helpers

Requirements update

11 Apr 11:38
d4427c1
Compare
Choose a tag to compare
Requirements update Pre-release
Pre-release
  • removed requiring minime/annotations package;
  • set guzzle package requiement to min 6.0

Small fixes

19 Mar 12:14
bef4c90
Compare
Choose a tag to compare
  • fixed bug with scopeOrderByRelated method in Laravel 8

Collection update

22 Nov 11:14
ecbfdc3
Compare
Choose a tag to compare
  • increased required Laravel version up to 5.4 instead of 5.2;
  • increased required php version up to 7.1 instead of 7.0;
  • update methods and arguments typing;
  • moved default empty rules method to the BaseRequest class;
  • removed all deprecated classes;
  • updated HttpRequestService class: renamed all base methods, removed send prefix, also now it works in chain mode
$result = app(HttpRequestService::class)->get($url)->json();

$response = app(HttpRequestService::class)->post($url, $data)->getResponse();
  • removed deprecated methods;
  • Implemented MockClassTrait class
use MockClassTrait;

pubic function testCreate()
{
        $this->mockClass(UserService::class, [
            ['method' => 'generateHash', 'result' => $hash]
        ]);
}
  • removed legacy setForceVisibleFields/setForceHiddenFields
  • updated result format of SearchTrait/EntityControlTrait from arrays to Collection/Model/null;
  • removed duplicated with/withRelations and withCount/withRelationsCount methods
$this->with('role')->withCount('images')->find($id)

$this
    ->with(Are::get($filters, 'with'))
    ->withCount(Are::get($filters, 'with_count'))
    ->searchQuery($filters)
    ->getSearchResults();
  • implemented new extract_last_part helper
$path = 'user.setting.name'

list($path, $lastPart) = extract_last_part($path);

//$path = 'user.setting'
//$lastPart = 'name'

Export mode update

10 Nov 11:10
4316647
Compare
Choose a tag to compare
  • Method assertEqualsFixture now has the third argument $exportMode = false, set it to true to export expected data to the fixture from the first argument and don't forget to remove it after :)
  • Renamed some methods;
  • Removed strict types from the base repository methods (strict types will be reverted after major version)

Hide/Show update

09 Nov 13:01
fce98a8
Compare
Choose a tag to compare
  • Implemented new methods that allow hiding/showing fields from the result:

Method makeHidden($fields) will hide fields from the attribute from the result.

app(OrderService::class)->makeHidden(['fee', 'personal_fee'])->get();

it also will work with the single field name

app(OrderService::class)->makeHidden('discount_percent')->first($id);

Method makeVisible($fields) will show hidden in the model class fields from the attribute in the result.

app(UserService::class)->makeVisible('password')->find($id);

Both methods work on the collection level, so it wouldn't modify the select clause of your query.

  • Extended updateMany method

Now it has the third argument that allows you to specify whether to return affected rows or affected rows count

app(CategoryService::class)->updateMany(['is_global' => false], ['is_global' => true], true)

It also returns correct results now (fixed bug with unexpected affected rows in the result).

As now updateMany method works via the chunk method (to save updated ids before the update, it will skip with $updatedRecordsAsResult = false) - it has the fought argument to set the limit per chunk

app(CategoryService::class)->updateMany(['is_global' => false], ['is_global' => true], true)
  • For the Laravel 8 and later getSearchResults method with flag all = true will return the same pagination format as for page/per_page flags.

  • Fixed bug with nonworking filterByQuery() method with the integer field in argument (in Postgre SQL)

$this->searchQuery($filters)->filterByQuery(['id'])->getSearchResults()

now will work fine

  • set types for EntityControlTrait methods and arguments

  • small fixes

1.5.0: Merge pull request #11 from RonasIT/dpankratov/version-update

02 Dec 06:32
d8516be
Compare
Choose a tag to compare
  • increased minime/annotations package min version;
  • added sorting by the field length result of the onlyValidated method;
  • updated BaseExporter class to able to set disk for the storing exported files;
  • renamed unique_except_of_current_user validation rule to the unique_except_of_authorized_user (Breaking change)
  • fixed withRelationsCount method logic, now it will work correctly with the dot notation
app(UserService::class)->withCount(['contact.addressed'])->get()
  • withRelationsCount and withRelations now will wrap argument to an array, so the next construction will work correctly now
app(UserService::class)->withRelations('roles')->first()
  • fixed logic of the firstOrCreate method, now fields from the second argument are priority than from the first;
  • callRawRequest now will return $this context;
  • failing tests with the export JSON mode will now occur in export content method (not only JSON);
  • big update of assertMailEquals method, able to redefine some default checks and implement custom, implemented validation of input params;

BaseRequest update

20 Jan 08:45
221b112
Compare
Choose a tag to compare
  • added new BaseRequest class with onlyValidated method;
  • removed beta tag;

updateMany fix

22 Aug 05:12
0b33c8a
Compare
Choose a tag to compare
  • added an ability to use dot notation in fieldName argument of the updateMany method

Syntax update

22 Aug 02:39
02ce738
Compare
Choose a tag to compare
  • changed array_* and str_* helpers functions to facade methods Arr::* and Str::*;
  • added annotations to some methods;
  • added php 7 types to some methods;
  • implemented chunk method;
  • fixed bug with incorrect page urls with using all flag in the search method;
  • fixed orderBy method, now it calls orderBy or orderByRelated instead of only orderByRelated;

Order by relation field fix

08 Aug 15:48
64baa39
Compare
Choose a tag to compare
  • fixed bug with the order by field of the relation with the additional where clause;