Skip to content

Commit

Permalink
Merge pull request #51 from Evdigi-INA/dev
Browse files Browse the repository at this point in the history
v0.3.0
  • Loading branch information
Zzzul authored Aug 13, 2024
2 parents 299992a + e38a384 commit 2422cdc
Show file tree
Hide file tree
Showing 152 changed files with 5,835 additions and 2,511 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: "Run Tests - Current"

on: [push, pull_request]

jobs:
test:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: [8.3, 8.2]
laravel: ["^11.0"]
dependency-version: [prefer-stable, prefer-lowest]
include:
- laravel: "^11.0"
testbench: 9.*
exclude:
- laravel: "^11.0"
php: 8.1

name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} - ${{ matrix.dependency-version }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: curl, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, iconv
coverage: none

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "symfony/console:>=4.3.4" "mockery/mockery:^1.3.2" "nesbot/carbon:>=2.62.1" --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
- name: Execute tests
run: vendor/bin/phpunit
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
composer.lock
.phpunit.result.cache
generator-cache.json
generator.cache
.idea
.phpunit.cache
.phpunit.result.cache
50 changes: 40 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"description": "Laravel starter app & simple crud generator",
"type": "library",
"license": "MIT",
"homepage": "https://github.com/Evdigi-INA/generator",
"keywords": [
"package",
"laravel",
Expand All @@ -22,35 +23,64 @@
{
"name": "Mohammad Zulfahmi",
"email": "mohammad.zulfahmi03@gmail.com",
"homepage": "https://github.com/Evdigi-INA/generator"
"homepage": "https://github.com/Zzzul"
}
],
"require": {
"php": "^8.2",
"intervention/image": "^2.7",
"yajra/laravel-datatables-oracle": "^10.0"
"intervention/image-laravel": "^1.1",
"yajra/laravel-datatables-oracle": "^10.0|^11.0"
},
"require-dev": {
"nunomaduro/collision": "^6.3",
"orchestra/testbench": "^7.14"
"larastan/larastan": "^2.0",
"nunomaduro/phpinsights": "^2.11",
"orchestra/testbench": "^9.0"
},
"config": {
"optimize-autoloader": true,
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"extra": {
"laravel": {
"providers": [
"EvdigiIna\\Generator\\Providers\\GeneratorServiceProvider",
"Yajra\\DataTables\\DataTablesServiceProvider",
"Intervention\\Image\\ImageServiceProvider"
"Yajra\\DataTables\\DataTablesServiceProvider"
],
"aliases": {
"DataTables": "Yajra\\DataTables\\Facades\\DataTables",
"Image": "Intervention\\Image\\Facades\\Image"
"DataTables": "Yajra\\DataTables\\Facades\\DataTables"
}
}
},
"autoload-dev": {
"psr-4": {
"Workbench\\App\\": "workbench/app/",
"Workbench\\Database\\Factories\\": "workbench/database/factories/",
"Workbench\\Database\\Seeders\\": "workbench/database/seeders/"
}
},
"scripts": {
"post-autoload-dump": [
"@clear",
"@prepare"
],
"clear": "@php vendor/bin/testbench package:purge-skeleton --ansi",
"prepare": "@php vendor/bin/testbench package:discover --ansi",
"build": "@php vendor/bin/testbench workbench:build --ansi",
"serve": [
"Composer\\Config::disableProcessTimeout",
"@build",
"@php vendor/bin/testbench serve"
],
"lint": [
"@php vendor/bin/phpstan analyse"
],
"test": [
"@php vendor/bin/phpunit"
]
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function run(): void
{
app()[\Spatie\Permission\PermissionRegistrar::class]->forgetCachedPermissions();

$roleAdmin = Role::create(['name' => 'Admin']);
$roleAdmin = Role::create(['name' => 'admin']);

foreach (config('permission.permissions') as $permission) {
foreach ($permission['access'] as $access) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ public function run(): void
'remember_token' => Str::random(10),
]);

User::factory()->count(50)->create();
User::factory()->count(10)->create();
}
}
19 changes: 19 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
includes:
- vendor/larastan/larastan/extension.neon

parameters:

paths:
- src/
- tests/

# Level 9 is the highest level
level: 5

# ignoreErrors:
# - '#PHPDoc tag @var#'
#
# excludePaths:
# - ./*/*/FileToBeExcluded.php
#
# checkMissingIterableValueType: false
28 changes: 12 additions & 16 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
>
<testsuites>
<testsuite name="Package Test Suite">
<directory suffix=".php">./tests/</directory>
</testsuite>
</testsuites>
</phpunit>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.0/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<testsuites>
<testsuite name="Package Test Suite">
<directory suffix=".php">./tests/</directory>
</testsuite>
</testsuites>
<php>
<env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
<env name="DB_CONNECTION" value="testing"/>
<env name="APP_ENV" value="local"/>
</php>
</phpunit>
21 changes: 21 additions & 0 deletions phpunit.xml.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
>
<testsuites>
<testsuite name="Package Test Suite">
<directory suffix=".php">./tests/</directory>
</testsuite>
</testsuites>
<php>
<env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
<env name="DB_CONNECTION" value="testing"/>
</php>
</phpunit>
88 changes: 88 additions & 0 deletions resources/views/api-create.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
@extends('layouts.app')

@section('title', __('Create Module (API)'))

@push('css')
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css"
integrity="sha512-KfkfwYDsLkIlwQp6LFnl8zNdLGxu9YAA1QvwINks4PhcElQSvqcyVLLD9aMhXd13uQjoXtEKNosOWaZqXgel0g=="
crossorigin="anonymous" referrerpolicy="no-referrer" />
@endpush

@section('content')
<div class="page-heading">
<div class="page-title">
<div class="row">
<div class="col-12 col-md-8 order-md-1 order-last">
<h3>
{{ __('API Generators') }}
<small style="font-size: 8px;">Beta</small>
</h3>
<p class="text-subtitle text-muted">
{{ __('Create a new CRUD Module (API).') }}
</p>
</div>

<x-breadcrumb>
<li class="breadcrumb-item">
<a href="/">{{ __('Dashboard') }}</a>
</li>
<li class="breadcrumb-item active" aria-current="page">
{{ __('API Generators') }}
</li>
</x-breadcrumb>
</div>
</div>

<section class="section">
<x-alert />

{{-- <div class="alert alert-info alert-dismissible fade show" role="alert">
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
<h6 class="alert-heading">{{ __('Info') }}</h6>
<p>
<a href="https://zzzul.github.io/generator-docs-next/usage#creating-api-crud" target="_blank">
{{ __('Please consider to read about new Laravel 11 API') }}
</a>
</p>
</div> --}}

<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-body">
<form action="/api-generators" method="POST" id="form-generator">
@csrf
@method('POST')

@include('generator::include.api-form')

<a href="{{ url()->previous() }}" id="btn-back"
class="btn btn-secondary">{{ __('Back') }}</a>

<button type="submit" id="btn-save" class="btn btn-primary">{{ __('Generate') }}</button>
</form>
</div>
</div>

<div id="validation-errors" style="display: none;">
<div class="alert alert-danger fade show" role="alert">
<h4 class="alert-heading">Error</h4>
<ul class="mb-0"></ul>
</div>
</div>
</div>
</div>
</section>
</div>
@endsection

@push('js')
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"
integrity="sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script>

<script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>
@include('generator::include.js.api-create-js')

@include('generator::include.js.function-js')
@endpush
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
@section('title', __('Create Module'))

@push('css')
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css" integrity="sha512-KfkfwYDsLkIlwQp6LFnl8zNdLGxu9YAA1QvwINks4PhcElQSvqcyVLLD9aMhXd13uQjoXtEKNosOWaZqXgel0g==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css"
integrity="sha512-KfkfwYDsLkIlwQp6LFnl8zNdLGxu9YAA1QvwINks4PhcElQSvqcyVLLD9aMhXd13uQjoXtEKNosOWaZqXgel0g=="
crossorigin="anonymous" referrerpolicy="no-referrer" />
@endpush

@section('content')
Expand All @@ -29,7 +31,7 @@
</div>

<section class="section">
<x-alert></x-alert>
<x-alert />

<div class="row">
<div class="col-md-12">
Expand All @@ -41,7 +43,8 @@

@include('generator::include.form')

<a href="{{ url()->previous() }}" id="btn-back" class="btn btn-secondary">{{ __('Back') }}</a>
<a href="{{ url()->previous() }}" id="btn-back"
class="btn btn-secondary">{{ __('Back') }}</a>

<button type="submit" id="btn-save" class="btn btn-primary">{{ __('Generate') }}</button>
</form>
Expand Down
Loading

0 comments on commit 2422cdc

Please sign in to comment.