Skip to content

Commit

Permalink
Added telescope, basic project endpoint, basic filament resources, Gi…
Browse files Browse the repository at this point in the history
…tHub actions
  • Loading branch information
korridor committed Jan 28, 2024
1 parent 5123600 commit e5a35d5
Show file tree
Hide file tree
Showing 64 changed files with 2,069 additions and 131 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/npm-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ jobs:
runs-on: ubuntu-latest

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

- uses: shivammathur/setup-php@v2
with:
php-version: '8.3.1'
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/npm-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ jobs:
runs-on: ubuntu-latest

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

- name: Use Node.js
uses: actions/setup-node@v3
with:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/npm-typecheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ jobs:
runs-on: ubuntu-latest

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

- name: Use Node.js
uses: actions/setup-node@v3
with:
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Static code analysis (PHPStan)
on: push
jobs:
phpstan:
runs-on: ubuntu-latest

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

- name: "Setup PHP"
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv
coverage: none

- name: "Run composer install"
run: composer install -n --prefer-dist

- name: "Run PHPStan"
run: composer analyse


38 changes: 38 additions & 0 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: PHPUnit Tests
on: push
jobs:
phpunit:
runs-on: ubuntu-latest

services:
mysql:
image: postgres:15
env:
PGPASSWORD: 'root'
POSTGRES_DB: 'laravel'
POSTGRES_USER: 'root'
POSTGRES_PASSWORD: 'root'
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: "Checkout code"
uses: actions/checkout@v4

- name: "Setup PHP"
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv
coverage: none

- name: "Run composer install"
run: composer install -n --prefer-dist

- name: "Run PHPUnit"
run: composer test
6 changes: 4 additions & 2 deletions .github/workflows/pint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ jobs:
pint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: "laravel-pint"
- name: "Checkout code"
uses: actions/checkout@v4

- name: "Check code style"
uses: aglipanci/[email protected]
with:
configPath: "pint.json"
4 changes: 3 additions & 1 deletion .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ jobs:
image: 'axllent/mailpit:latest'

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

- uses: actions/setup-node@v3
with:
node-version: 18
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/public/storage
/public/css
/public/js
/public/vendor
/lang/vendor
/storage/*.key
/vendor
Expand Down
77 changes: 77 additions & 0 deletions app/Filament/Resources/ClientResource.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?php

declare(strict_types=1);

namespace App\Filament\Resources;

use App\Filament\Resources\ClientResource\Pages;
use App\Models\Client;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;

class ClientResource extends Resource
{
protected static ?string $model = Client::class;

protected static ?string $navigationIcon = 'heroicon-o-briefcase';

protected static ?string $navigationGroup = 'Timetracking';

public static function form(Form $form): Form
{
return $form
->schema([
//
]);
}

public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('name')
->label('Name')
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('organization.name')
->sortable()
->label('Organization'),
Tables\Columns\TextColumn::make('created_at')
->label('Created at')
->sortable(),
Tables\Columns\TextColumn::make('updated_at')
->label('Updated at')
->sortable(),
])
->defaultSort('created_at', 'desc')
->filters([
//
])
->actions([
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}

public static function getRelations(): array
{
return [
//
];
}

public static function getPages(): array
{
return [
'index' => Pages\ListClients::route('/'),
'create' => Pages\CreateClient::route('/create'),
'edit' => Pages\EditClient::route('/{record}/edit'),
];
}
}
13 changes: 13 additions & 0 deletions app/Filament/Resources/ClientResource/Pages/CreateClient.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

namespace App\Filament\Resources\ClientResource\Pages;

use App\Filament\Resources\ClientResource;
use Filament\Resources\Pages\CreateRecord;

class CreateClient extends CreateRecord
{
protected static string $resource = ClientResource::class;
}
21 changes: 21 additions & 0 deletions app/Filament/Resources/ClientResource/Pages/EditClient.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

declare(strict_types=1);

namespace App\Filament\Resources\ClientResource\Pages;

use App\Filament\Resources\ClientResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;

class EditClient extends EditRecord
{
protected static string $resource = ClientResource::class;

protected function getHeaderActions(): array
{
return [
Actions\DeleteAction::make(),
];
}
}
21 changes: 21 additions & 0 deletions app/Filament/Resources/ClientResource/Pages/ListClients.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

declare(strict_types=1);

namespace App\Filament\Resources\ClientResource\Pages;

use App\Filament\Resources\ClientResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;

class ListClients extends ListRecords
{
protected static string $resource = ClientResource::class;

protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make(),
];
}
}
82 changes: 82 additions & 0 deletions app/Filament/Resources/OrganizationResource.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?php

declare(strict_types=1);

namespace App\Filament\Resources;

use App\Filament\Resources\OrganizationResource\Pages;
use App\Models\Organization;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;

class OrganizationResource extends Resource
{
protected static ?string $model = Organization::class;

protected static ?string $navigationIcon = 'heroicon-o-building-office-2';

protected static ?string $navigationGroup = 'Users';

public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('name')
->label('Name')
->required()
->maxLength(255),
Forms\Components\Toggle::make('Is personal?')
->label('Is personal?')
->required(),
Forms\Components\Select::make('owner_id')
->relationship(name: 'owner', titleAttribute: 'email')
->searchable(['name', 'email'])
->required(),
]);
}

public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('name')
->searchable()
->sortable(),
Tables\Columns\ToggleColumn::make('is_personal')
->label('Is personal?')
->sortable(),
Tables\Columns\TextColumn::make('owner.email')
->sortable(),
])
->filters([
//
])
->actions([
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}

public static function getRelations(): array
{
return [
//
];
}

public static function getPages(): array
{
return [
'index' => Pages\ListOrganizations::route('/'),
'create' => Pages\CreateOrganization::route('/create'),
'edit' => Pages\EditOrganization::route('/{record}/edit'),
];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

namespace App\Filament\Resources\OrganizationResource\Pages;

use App\Filament\Resources\OrganizationResource;
use Filament\Resources\Pages\CreateRecord;

class CreateOrganization extends CreateRecord
{
protected static string $resource = OrganizationResource::class;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

declare(strict_types=1);

namespace App\Filament\Resources\OrganizationResource\Pages;

use App\Filament\Resources\OrganizationResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;

class EditOrganization extends EditRecord
{
protected static string $resource = OrganizationResource::class;

protected function getHeaderActions(): array
{
return [
Actions\DeleteAction::make(),
];
}
}
Loading

0 comments on commit e5a35d5

Please sign in to comment.