Skip to content

Commit

Permalink
Merge branch 'release/v0.1.18'
Browse files Browse the repository at this point in the history
  • Loading branch information
happytodev committed Aug 3, 2022
2 parents f9d6780 + 1a4861d commit 8870e2b
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 26 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
All notable changes to `typhoon` will be documented in this file.


## v0.1.18 - 2022-08-03
- Fix issue [#20](https://github.com/happytodev/typhoon/issues/20) : Tag slug is not automatically generated
- Fix issue [#22](https://github.com/happytodev/typhoon/issues/22) : Error when launch php artisan route:list command
- Now you can give some support to Typhoon by starring it in his github repository during installation :-)

## v0.1.17 - 2022-08-02
- Fix issue [#19](https://github.com/happytodev/typhoon/issues/19) : The navigation in admin does not work correctly

Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@
"extra": {
"laravel": {
"providers": [
"HappyToDev\\Typhoon\\TyphoonServiceProvider"
"HappyToDev\\Typhoon\\TyphoonServiceProvider",
"HappyToDev\\Typhoon\\App\\Providers\\RepositoryServiceProvider"
],
"aliases": {
"Typhoon": "HappyToDev\\Typhoon\\Facades\\Typhoon"
Expand All @@ -84,4 +85,4 @@
],
"minimum-stability": "dev",
"prefer-stable": true
}
}
19 changes: 0 additions & 19 deletions src/App/Filament/Resources/PostResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,31 +32,12 @@ class PostResource extends Resource

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

// public static function form(Form $form): Form
// {
// return $form
// ->schema([
// Forms\Components\TextInput::make('title')
// ->required(),
// Forms\Components\TextInput::make('tldr'),
// Forms\Components\TextInput::make('slug'),
// Forms\Components\Textarea::make('content'),
// BelongsToSelect::make('user_id')
// ->resource(UserResource::class)
// ->required(),
// Forms\Components\TextInput::make('user_id')
// ->required(),
// ]);
// }

public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('title'),
Tables\Columns\TextColumn::make('tldr'),
//Tables\Columns\TextColumn::make('slug'),
//Tables\Columns\TextColumn::make('content'),
Tables\Columns\TextColumn::make('user_id'),
Tables\Columns\TextColumn::make('created_at')
->dateTime(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
namespace App\Filament\Resources\PostResource\RelationManagers;

use Filament\Forms;
use Filament\Tables;
use Illuminate\Support\Str;
use Filament\Resources\Form;
use Filament\Resources\RelationManagers\BelongsToManyRelationManager;
use Filament\Resources\Table;
use Filament\Tables;
use Filament\Resources\RelationManagers\BelongsToManyRelationManager;

class TagsRelationManager extends BelongsToManyRelationManager
{
Expand All @@ -21,7 +22,11 @@ public static function form(Form $form): Form
return $form
->schema([
Forms\Components\TextInput::make('name')
->required(),
->reactive()
->required()
->afterStateUpdated(function ($set, ?string $state) {
$set('slug', Str::slug($state));
}),
Forms\Components\TextInput::make('slug'),
Forms\Components\TextInput::make('description'),
// Forms\Components\Textarea::make('content'),
Expand Down
31 changes: 31 additions & 0 deletions src/App/Providers/RepositoryServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace HappyToDev\Typhoon\App\Providers;

use App\Repositories\PostRepository;
use Illuminate\Support\ServiceProvider;
use App\Interfaces\PostRepositoryInterface;

class RepositoryServiceProvider extends ServiceProvider
{
/**
* Register services.
*
* @return void
*/
public function register()
{
//
$this->app->bind(PostRepositoryInterface::class, PostRepository::class);
}

/**
* Bootstrap services.
*
* @return void
*/
public function boot()
{
//
}
}
42 changes: 40 additions & 2 deletions src/Console/InstallTyphoonPackage.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ public function handle()
$this->publishRepositories(true);
$this->info('>>> Publishing repositories : done');

// publish RepositoryServiceProvider.php file
$this->info('>>> Publishing RepositoryServiceProvider.php files...');
$this->publishRepositoryServiceProvider(true);
$this->info('>>> Publishing RepositoryServiceProvider.php : done');

// publish Langs files
$this->info('>>> Publishing Langs files...');
$this->publishLangs(true);
Expand All @@ -85,7 +90,7 @@ public function handle()
$this->filamentSocialNetworksAssets();
$this->info('>>> Publishing filament-social-networks assets : done');

// FilamentSocialNetworks Assets
// Filament Navigation Assets
$this->info('>>> Publishing filament-navigation assets...');
$this->publishFilamentNavigationAssets(true);
$this->info('>>> Publishing filament-navigation assets : done');
Expand All @@ -101,7 +106,8 @@ public function handle()
$this->info('>>> Install demo datas : done');

// Installation done with success
$this->info('TyphoonCMS Package installed successfully.');
$this->info('TyphoonCMS Package installed successfully. 🚀');
$this->askForSomeLove();
$this->info('You can now edit `content/users/1.md`');
$this->info('And change `is_admin: 0` to `is_admin: 1`');
$this->info('to be authorized to access the admin panel.');
Expand Down Expand Up @@ -250,6 +256,20 @@ private function publishRepositories($forcePublish = false)
$this->call('vendor:publish', $params);
}

private function publishRepositoryServiceProvider($forcePublish = false)
{
$params = [
'--provider' => "HappyToDev\Typhoon\TyphoonServiceProvider",
'--tag' => "typhoon-repository-service-provider"
];

if ($forcePublish === true) {
$params['--force'] = true;
}

$this->call('vendor:publish', $params);
}

private function publishInterfaces($forcePublish = false)
{
$params = [
Expand Down Expand Up @@ -327,4 +347,22 @@ private function installFilamentComments()
{
$this->call('filament-comments:install');
}

protected function askForSomeLove(): void
{

if ($this->confirm('Would you like to show some love to Typhoon by starring the repo 🙏 ?', true)) {
if (PHP_OS_FAMILY === 'Darwin') {
exec('open https://github.com/happytodev/typhoon');
}
if (PHP_OS_FAMILY === 'Linux') {
exec('xdg-open https://github.com/happytodev/typhoon');
}
if (PHP_OS_FAMILY === 'Windows') {
exec('start https://github.com/happytodev/typhoon');
}

$this->line('Thank you!');
}
}
}
5 changes: 5 additions & 0 deletions src/TyphoonServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ public function boot()
__DIR__ . '/App/Repositories' => app_path('Repositories'),
], 'typhoon-repositories');

// Loads RepositoryServiceProvider
$this->publishes([
__DIR__ . '/App/Providers/RepositoryServiceProvider.php' => app_path('Providers/RepositoryServiceProvider.php'),
], 'typhoon-repository-service-provider');

// Loads langs
$this->publishes([
__DIR__ . '/Lang' => base_path('lang'),
Expand Down

0 comments on commit 8870e2b

Please sign in to comment.