Skip to content

Commit

Permalink
chore(*): initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ElRochito committed Apr 8, 2022
1 parent 0f243f9 commit 72d2671
Show file tree
Hide file tree
Showing 47 changed files with 1,580 additions and 402 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github: :vendor_name
github: soyhuce
8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
blank_issues_enabled: false
contact_links:
- name: Ask a question
url: https://github.com/:vendor_name/:package_name/discussions/new?category=q-a
url: https://github.com/Soyhuce/laravel-eloquent-extended/discussions/new?category=q-a
about: Ask the community for help
- name: Request a feature
url: https://github.com/:vendor_name/:package_name/discussions/new?category=ideas
url: https://github.com/Soyhuce/laravel-eloquent-extended/discussions/new?category=ideas
about: Share ideas for new features
- name: Report a security issue
url: https://github.com/:vendor_name/:package_name/security/policy
url: https://github.com/Soyhuce/laravel-eloquent-extended/security/policy
about: Learn how to notify us for sensitive bugs
- name: Report a bug
url: https://github.com/:vendor_name/:package_name/issues/new
url: https://github.com/Soyhuce/laravel-eloquent-extended/issues/new
about: Report a reproducable bug
2 changes: 1 addition & 1 deletion .github/SECURITY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Security Policy

If you discover any security related issues, please email author@domain.com instead of using the issue tracker.
If you discover any security related issues, please email bastien.philippe@soyhuce.fr instead of using the issue tracker.
2 changes: 0 additions & 2 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php declare(strict_types=1);

$finder = PhpCsFixer\Finder::create()->in([
'config',
'database',
'src',
'tests',
]);
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Changelog

All notable changes to `:package_name` will be documented in this file.
All notable changes to `laravel-eloquent-extended` will be documented in this file.
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) :vendor_name <author@domain.com>
Copyright (c) Soyhuce <bastien.philippe@soyhuce.fr>

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
92 changes: 51 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,61 +1,71 @@
# :package_description

[![Latest Version on Packagist](https://img.shields.io/packagist/v/:vendor_slug/:package_slug.svg?style=flat-square)](https://packagist.org/packages/:vendor_slug/:package_slug)
[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/:vendor_slug/:package_slug/run-tests?label=tests)](https://github.com/:vendor_slug/:package_slug/actions?query=workflow%3Arun-tests+branch%3Amain)
[![GitHub Code Style Action Status](https://img.shields.io/github/workflow/status/:vendor_slug/:package_slug/Check%20&%20fix%20styling?label=code%20style)](https://github.com/:vendor_slug/:package_slug/actions?query=workflow%3A"Check+%26+fix+styling"+branch%3Amain)
[![GitHub PHPStan Action Status](https://img.shields.io/github/workflow/status/:vendor_slug/:package_slug/PHPStan?label=phpstan)](https://github.com/:vendor_slug/:package_slug/actions?query=workflow%3APHPStan+branch%3Amain)
[![Total Downloads](https://img.shields.io/packagist/dt/:vendor_slug/:package_slug.svg?style=flat-square)](https://packagist.org/packages/:vendor_slug/:package_slug)
<!--delete-->
---
This repo can be used to scaffold a Laravel package. Follow these steps to get started:

1. Press the "Use template" button at the top of this repo to create a new repo with the contents of this skeleton.
2. Run "php ./configure.php" to run a script that will replace all placeholders throughout all the files.
3. Have fun creating your package.
---
<!--/delete-->
# Some useful extensions for Eloquent

[![Latest Version on Packagist](https://img.shields.io/packagist/v/soyhuce/laravel-eloquent-extended.svg?style=flat-square)](https://packagist.org/packages/soyhuce/laravel-eloquent-extended)
[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/soyhuce/laravel-eloquent-extended/run-tests?label=tests)](https://github.com/soyhuce/laravel-eloquent-extended/actions?query=workflow%3Arun-tests+branch%3Amain)
[![GitHub Code Style Action Status](https://img.shields.io/github/workflow/status/soyhuce/laravel-eloquent-extended/Check%20&%20fix%20styling?label=code%20style)](https://github.com/soyhuce/laravel-eloquent-extended/actions?query=workflow%3A"Check+%26+fix+styling"+branch%3Amain)
[![GitHub PHPStan Action Status](https://img.shields.io/github/workflow/status/soyhuce/laravel-eloquent-extended/PHPStan?label=phpstan)](https://github.com/soyhuce/laravel-eloquent-extended/actions?query=workflow%3APHPStan+branch%3Amain)
[![Total Downloads](https://img.shields.io/packagist/dt/soyhuce/laravel-eloquent-extended.svg?style=flat-square)](https://packagist.org/packages/soyhuce/laravel-eloquent-extended)

This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.

## Installation

You can install the package via composer:

```bash
composer require :vendor_slug/:package_slug
composer require soyhuce/laravel-eloquent-extended
```

You can publish and run the migrations with:

```bash
php artisan vendor:publish --tag=":package_slug-migrations"
php artisan migrate
```
## Usage

You can publish the config file with:
## Builder

```bash
php artisan vendor:publish --tag=":package_slug-config"
```
### Misc

This is the contents of the published config file:
- Builder::scope(Illuminate\Database\Eloquent\Scope $score): Builder
- Builder::scoped(\Closure $callable): Builder

```php
return [
];
```
### Ordering

Optionally, you can publish the views using
- Builder::preventInvalidDirection(string $direction): void
- Builder::orderByNullsLast(string $column, string $direction = 'asc'): Builder
- Builder::orderByRawNullsLast(string $sql): Builder
- Builder::orderByAggregate( string $relationName, string $column, string $direction = 'asc', ?string $function = null,
?Closure $constraints = null)
- Builder::orderByExists(string $relation, ?Closure $constraints = null, string $direction = 'asc')
- Builder::orderByExistsDesc(string $relation, ?Closure $constraints = null)
- Builder::orderByCount(string $relation, ?Closure $constraints = null, string $direction = 'asc')
- Builder::orderByCountDesc(string $relation, ?Closure $constraints = null)
- Builder::orderBySum(string $relation, string $column, ?Closure $constraints = null, string $direction = 'asc')
- Builder::orderBySumDesc(string $relation, string $column, ?Closure $constraints = null)
- Builder::orderByMin(string $relation, string $column, ?Closure $constraints = null, string $direction = 'asc')
- Builder::orderByMinDesc(string $relation, string $column, ?Closure $constraints = null)
- Builder::orderByMax(string $relation, string $column, ?Closure $constraints = null, string $direction = 'asc')
- Builder::orderByMaxDesc(string $relation, string $column, ?Closure $constraints = null)

```bash
php artisan vendor:publish --tag=":package_slug-views"
```
### Result

## Usage
- Builder::random(): Model

### Select

- Builder::withAggregateFunction( $relations, \Soyhuce\EloquentExtended\Aggregates\Contracts\AggregateFunction
$aggregateFunction): Builder
- Builder::withAnyExists(array $relations, string $alias = 'related_exists') : Builder
- Builder::withImplode($relations, string $column, string $glue, ?string $orderBy = null, string $direction = 'asc') :
Builder

## Eloquent Collection

- Collection::loadAttributes(Closure(Builder): Builder|void $loadWith): Collection

## Model traits

### LoadsAttributes

- Model::loadAttributes(Closure(Builder): Builder|void $loadWith): Model

```php
$variable = new VendorName\Skeleton();
echo $variable->echoPhrase('Hello, VendorName!');
```

## Testing

Expand All @@ -77,7 +87,7 @@ Please review [our security policy](../../security/policy) on how to report secu

## Credits

- [:author_name](https://github.com/:author_username)
- [Bastien Philippe](https://github.com/bastien-phi)
- [All Contributors](../../contributors)

## License
Expand Down
40 changes: 21 additions & 19 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
{
"name": ":vendor_slug/:package_slug",
"description": ":package_description",
"name": "soyhuce/laravel-eloquent-extended",
"description": "Some useful extensions for Eloquent",
"keywords": [
":vendor_name",
"Soyhuce",
"laravel",
":package_slug"
"eloquent"
],
"homepage": "https://github.com/:vendor_slug/:package_slug",
"homepage": "https://github.com/soyhuce/laravel-eloquent-extended",
"license": "MIT",
"authors": [
{
"name": ":author_name",
"email": "author@domain.com",
"name": "Bastien Philippe",
"email": "bastien.philippe@soyhuce.fr",
"role": "Developer"
}
],
"require": {
"php": "^8.1",
"spatie/laravel-package-tools": "^1.9.2",
"illuminate/contracts": "^9.0"
"illuminate/contracts": "^9.7",
"illuminate/database": "^9.7"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.7",
Expand All @@ -30,17 +30,17 @@
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^9.5"
"phpunit/phpunit": "^9.5",
"soyhuce/next-ide-helper": "^0.9.1"
},
"autoload": {
"psr-4": {
"VendorName\\Skeleton\\": "src",
"VendorName\\Skeleton\\Database\\Factories\\": "database/factories"
"Soyhuce\\EloquentExtended\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"VendorName\\Skeleton\\Tests\\": "tests"
"Soyhuce\\EloquentExtended\\Tests\\": "tests"
}
},
"scripts": {
Expand All @@ -55,16 +55,18 @@
]
},
"config": {
"sort-packages": true
"sort-packages": true,
"preferred-install": "dist",
"allow-plugins": {
"pestphp/pest-plugin": true,
"phpstan/extension-installer": true
}
},
"extra": {
"laravel": {
"providers": [
"VendorName\\Skeleton\\SkeletonServiceProvider"
],
"aliases": {
"Skeleton": "VendorName\\Skeleton\\Facades\\Skeleton"
}
"Soyhuce\\EloquentExtended\\EloquentExtendedServiceProvider"
]
}
},
"minimum-stability": "dev",
Expand Down
2 changes: 1 addition & 1 deletion config/skeleton.php → config/eloquent-extended.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php declare(strict_types=1);
// config for VendorName/Skeleton
// config for Soyhuce/EloquentExtended
return [
];
Loading

0 comments on commit 72d2671

Please sign in to comment.