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 Feb 5, 2024
1 parent 5123600 commit 4b785b6
Show file tree
Hide file tree
Showing 80 changed files with 2,555 additions and 134 deletions.
5 changes: 5 additions & 0 deletions .env.ci
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=sqlite
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=root

BROADCAST_DRIVER=log
CACHE_DRIVER=file
Expand Down
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ APP_KEY=base64:UNQNf1SXeASNkWux01Rj8EnHYx8FO0kAxWNDwktclkk=
APP_DEBUG=true
APP_URL=http://localhost

SUPER_ADMINS=[email protected]

LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
Expand Down
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


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

services:
pgsql:
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: "Prepare Laravel Application"
run: |
cp .env.ci .env
php artisan key:generate
php artisan passport:install
- 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
82 changes: 82 additions & 0 deletions app/Filament/Resources/ClientResource.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\ClientResource\Pages;
use App\Models\Client;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Filters\SelectFilter;
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';

protected static ?int $navigationSort = 4;

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([
SelectFilter::make('organization')
->relationship('organization', 'name')
->searchable(),
])
->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(),
];
}
}
84 changes: 84 additions & 0 deletions app/Filament/Resources/OrganizationResource.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?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';

protected static ?int $navigationSort = 7;

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;
}
Loading

0 comments on commit 4b785b6

Please sign in to comment.