This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Pion\Support; | |
use Illuminate\Support\Collection; | |
/** | |
* Class GroupedCollection | |
* | |
* Collection that will support adding values with grouped index (collection indexed by groupKey) | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Pion\Traits\Models; | |
use Illuminate\Database\Eloquent\Model; | |
use Illuminate\Database\Eloquent\Relations\HasOne; | |
/** | |
* Trait RelationCountTrait | |
* | |
* Usage of where: $count = $model->relationCountWithWhere("user_permission", "user_id", $user, "App\\Models\\User"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Pion\Traits\Models; | |
/** | |
* Class NullEmptyStringAttributeTrait | |
* | |
* Enables the automatic nulling of empty string value. You can provide | |
* list of collumns keys to allow only specified collumns to be nulled. | |
* | |
* Usage for setting nullEmptyCollumns: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Pion\Traits\Models; | |
use Illuminate\Database\Query\Expression; | |
use Illuminate\Support\Str; | |
/** | |
* Class ModelJoinTrait | |
* | |
* Trait to create model join for scope with detection of model in the attributes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (CGSize)collectionViewContentSize { | |
CGSize contentSize = [super collectionViewContentSize]; | |
// we need to center last view | |
int items = [[self collectionView] numberOfItemsInSection:0]; | |
UICollectionViewLayoutAttributes* layoutAttribute = (UICollectionViewLayoutAttributes*)[super layoutAttributesForItemAtIndexPath:[NSIndexPath indexPathForItem:items-1 inSection:0]]; | |
float startX = contentSize.width - self.collectionView.bounds.size.width + self.collectionView.bounds.size.width / 2; | |
startX = layoutAttribute.frame.origin.x - startX; |