This commit is contained in:
Jérémy Munsch 2021-07-22 16:50:30 +02:00
commit c9de85693e
15 changed files with 7747 additions and 0 deletions

18
.editorconfig Normal file
View file

@ -0,0 +1,18 @@
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
[*.json]
indent_size = 4
[*.md]
trim_trailing_whitespace = false
[*.{yml,yaml}]
indent_size = 2

3
.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
workspace.code-workspace
vendor
node_modules

0
.gitkeep Normal file
View file

22
.vscode/launch.json vendored Normal file
View file

@ -0,0 +1,22 @@
{
// Utilisez IntelliSense pour en savoir plus sur les attributs possibles.
// Pointez pour afficher la description des attributs existants.
// Pour plus d'informations, visitez : https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9000
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9000
}
]
}

View file

@ -0,0 +1,8 @@
{
"folders": [
{
"path": "."
}
],
"settings": {}
}

4
changelog.md Normal file
View file

@ -0,0 +1,4 @@
# Changelog
All notable changes to `CRM CLient V2` will be documented in this file.

46
composer.json Normal file
View file

@ -0,0 +1,46 @@
{
"name": "ldc/ldccrmv2",
"description": "LDC CRM Client V2",
"license": "MIT",
"authors": [
{
"name": "Jérémy Munsch",
"email": "jeremy.munsch@ldc.fr",
"homepage": "https://jeremydev.ovh"
}
],
"homepage": "https://github.com/kwaadpepper",
"keywords": [
"Laravel",
"CRM",
"Client",
"LDC"
],
"require": {
"illuminate/support": "~7|~8",
"laravel/framework": "~7|~8",
"kwaadpepper/enum": "^0.1.4"
},
"require-dev": {
"phpunit/phpunit": "~9.0",
"squizlabs/php_codesniffer": "^3.5",
"orchestra/testbench": "^6.13"
},
"autoload": {
"psr-4": {
"LDC\\LDCCRM\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"LDC\\LDCCRM\\Tests\\": "tests"
}
},
"extra": {
"laravel": {
"providers": [
"LDC\\LDCCRM\\Providers\\CrmClientV2Provider"
]
}
}
}

7360
composer.lock generated Normal file

File diff suppressed because it is too large Load diff

21
license.md Normal file
View file

@ -0,0 +1,21 @@
MIT License (!! includes CC BY-NC 3.0 parts please read Readme.md)
Copyright (c) 2021 Jérémy Munsch
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

86
phpcs.xml Normal file
View file

@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="RealWorld" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">
<arg name="colors"/>
<arg name="extensions" value="php"/>
<file>src/</file>
<description>Created with the PHP Coding Standard Generator. http://edorian.github.com/php-coding-standard-generator/
</description>
<rule ref="Generic.CodeAnalysis.EmptyStatement" />
<rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop" />
<rule ref="Generic.CodeAnalysis.ForLoopWithTestFunctionCall" />
<rule ref="Generic.CodeAnalysis.JumbledIncrementer" />
<rule ref="Generic.CodeAnalysis.UnconditionalIfStatement" />
<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier" />
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter" />
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod" />
<rule ref="Generic.Commenting.Todo" />
<rule ref="Generic.Commenting.Fixme" />
<rule ref="Generic.ControlStructures.InlineControlStructure" />
<rule ref="Generic.Files.ByteOrderMark" />
<rule ref="Generic.Files.LineEndings" />
<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="120"/>
<property name="absoluteLineLimit" value="0"/>
</properties>
</rule>
<rule ref="Generic.Formatting.DisallowMultipleStatements" />
<rule ref="Generic.Formatting.NoSpaceAfterCast" />
<rule ref="Generic.Functions.CallTimePassByReference" />
<rule ref="Generic.Functions.FunctionCallArgumentSpacing" />
<rule ref="Generic.Metrics.CyclomaticComplexity" />
<rule ref="Generic.Metrics.NestingLevel" />
<rule ref="Generic.NamingConventions.ConstructorName" />
<rule ref="Generic.NamingConventions.UpperCaseConstantName" />
<rule ref="Generic.NamingConventions.CamelCapsFunctionName" />
<rule ref="Generic.PHP.DeprecatedFunctions" />
<rule ref="Generic.PHP.DisallowShortOpenTag" />
<rule ref="Generic.PHP.ForbiddenFunctions" />
<rule ref="Generic.PHP.LowerCaseConstant" />
<rule ref="Generic.PHP.NoSilencedErrors" />
<rule ref="Generic.Strings.UnnecessaryStringConcat" />
<rule ref="Generic.WhiteSpace.DisallowTabIndent" />
<rule ref="Generic.WhiteSpace.ScopeIndent" />
<rule ref="MySource.PHP.EvalObjectFactory" />
<rule ref="MySource.PHP.GetRequestData" />
<rule ref="MySource.PHP.AjaxNullComparison" />
<rule ref="PEAR.Classes.ClassDeclaration" />
<rule ref="PEAR.Commenting.InlineComment" />
<rule ref="PSR1.Classes.ClassDeclaration" />
<rule ref="PSR1.Files.SideEffects" />
<rule ref="Squiz.PHP.CommentedOutCode" />
<rule ref="Squiz.PHP.DisallowSizeFunctionsInLoops" />
<rule ref="Squiz.PHP.DiscouragedFunctions">
<properties>
<property name="error" value="true" />
</properties>
</rule>
<rule ref="Squiz.PHP.Eval" />
<rule ref="Squiz.PHP.GlobalKeyword" />
<rule ref="Squiz.PHP.Heredoc" />
<rule ref="Squiz.PHP.InnerFunctions" />
<rule ref="Squiz.PHP.LowercasePHPFunctions" />
<rule ref="Squiz.PHP.NonExecutableCode" />
<rule ref="Squiz.Scope.MemberVarScope" />
<rule ref="Squiz.Scope.MethodScope" />
<rule ref="Squiz.Scope.StaticThisUsage" />
<rule ref="Squiz.WhiteSpace.MemberVarSpacing" />
<rule ref="Squiz.WhiteSpace.ObjectOperatorSpacing">
<properties>
<property name="ignoreNewlines" value="true"/>
</properties>
</rule>
<rule ref="Squiz.WhiteSpace.OperatorSpacing">
<properties>
<property name="ignoreNewlines" value="true"/>
</properties>
</rule>
<rule ref="Squiz.WhiteSpace.ScopeKeywordSpacing" />
<rule ref="Squiz.WhiteSpace.SemicolonSpacing" />
<!-- For Laravel migrations -->
<rule ref="PSR1.Classes.ClassDeclaration.MissingNamespace">
<exclude-pattern>*/database/migrations/*</exclude-pattern>
</rule>
</ruleset>

31
readme.md Normal file
View file

@ -0,0 +1,31 @@
# LDC CRM api
[![Latest Version on Packagist][ico-version]][link-packagist]
[![Total Downloads][ico-downloads]][link-downloads]
Api client for CRM V2
## Installation
SOON available
## Usage
SOON available
## Change log
Please see the [changelog](changelog.md) for more information on what has changed recently.
## Testing
SOON available
## Credits
- [Jérémy Munsch](https://jeremydev.ovh)
## License
MIT. Please see the [license file](license.md) for more information.

49
src/Enums/CrudAction.php Normal file
View file

@ -0,0 +1,49 @@
<?php
namespace Kwaadpepper\CrudPolicies\Enums;
use Kwaadpepper\Enum\BaseEnum;
/**
*
* https://laravel.com/docs/8.x/authorization
* Controller Method Policy Method
* index viewAny
* show view
* create create
* store create
* edit update
* update update
* destroy delete
*
* @method static self viewAny()
* @method static self view()
* @method static self create()
* @method static self update()
* @method static self delete()
*/
class CrudAction extends BaseEnum
{
protected static function values(): array
{
return [
'viewAny' => 0,
'view' => 1,
'create' => 2,
'update' => 3,
'delete' => 4,
];
}
protected static function labels(): array
{
return [
'viewAny' => trans('crud-policies::crud.viewAny'),
'view' => trans('crud-policies::crud.view'),
'create' => trans('crud-policies::crud.create'),
'update' => trans('crud-policies::crud.update'),
'delete' => trans('crud-policies::crud.delete'),
];
}
}

71
src/Enums/CrudType.php Normal file
View file

@ -0,0 +1,71 @@
<?php
namespace Kwaadpepper\CrudPolicies\Enums;
use Kwaadpepper\Enum\BaseEnum;
/**
* @method static self boolean()
* @method static self int()
* @method static self string()
* @method static self text()
* @method static self json()
* @method static self image()
* @method static self email()
* @method static self password()
* @method static self float()
* @method static self enum()
* @method static self order()
* @method static self color()
* @method static self unsignedint()
* @method static self unsignedfloat()
* @method static self belongsTo()
* @method static self belongsToMany()
*/
class CrudType extends BaseEnum
{
protected static function values(): array
{
return [
'boolean' => 0,
'int' => 1,
'string' => 2,
'text' => 3,
'json' => 4,
'image' => 5,
'email' => 6,
'password' => 7,
'float' => 8,
'enum' => 9,
'order' => 10,
'color' => 11,
'unsignedint' => 12,
'unsignedfloat' => 13,
'belongsTo' => 21,
'belongsToMany' => 22
];
}
protected static function labels(): array
{
return [
'boolean' => trans('crud-policies::crud.boolean'),
'int' => trans('crud-policies::crud.int'),
'string' => trans('crud-policies::crud.string'),
'text' => trans('crud-policies::crud.text'),
'json' => trans('crud-policies::crud.json'),
'image' => trans('crud-policies::crud.image'),
'email' => trans('crud-policies::crud.email'),
'password' => trans('crud-policies::crud.password'),
'float' => trans('crud-policies::crud.float'),
'enum' => trans('crud-policies::crud.enum'),
'order' => trans('crud-policies::crud.order'),
'color' => trans('crud-policies::crud.color'),
'unsignedint' => trans('crud-policies::crud.unsignedint'),
'unsignedfloat' => trans('crud-policies::crud.unsignedfloat'),
'belongsTo' => trans('crud-policies::crud.belongsTo'),
'belongsToMany' => trans('crud-policies::crud.belongsToMany')
];
}
}

View file

@ -0,0 +1,9 @@
<?php
namespace Kwaadpepper\CrudPolicies\Exceptions;
use Exception;
class CrudException extends Exception
{
}

View file

@ -0,0 +1,19 @@
<?php
namespace LDC\LDCCRM;
use Illuminate\Support\ServiceProvider;
class CrmClientV2Provider extends ServiceProvider
{
public function boot()
{
}
public function register()
{
$this->app->booting(function () {
});
}
}