Skip to content

Commit

Permalink
Azuriom v1.0.0 (Azuriom#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMicky-FR authored Mar 13, 2022
1 parent 6111348 commit e0f1f8e
Show file tree
Hide file tree
Showing 257 changed files with 6,456 additions and 5,718 deletions.
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ DB_PASSWORD=

BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DRIVER=local
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
Expand All @@ -35,7 +35,7 @@ MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=null
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"

STEAM_KEY=
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
tests:
strategy:
matrix:
php-version: ['7.3', '7.4', '8.0', '8.1']
php-version: ['8.0', '8.1']

name: PHP ${{ matrix.php-version }}

Expand All @@ -21,7 +21,7 @@ jobs:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: azuriom
ports:
- 3306
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

steps:
Expand Down
9 changes: 5 additions & 4 deletions .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ ^$1 [N]
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /public/$1 [L,R=301]

# Handle assets in the public/ directory
RewriteCond %{REQUEST_URI} (\.\w+$) [NC]
RewriteRule ^(.*)$ public/$1

# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ server.php
RewriteRule ^ public/index.php [L]
</IfModule>
6 changes: 4 additions & 2 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
$finder = Finder::create()
->in(__DIR__.'/app')
->in(__DIR__.'/config')
->in(__DIR__.'/database')
->in(__DIR__.'/database/factories')
->in(__DIR__.'/database/seeders')
->in(__DIR__.'/resources/lang')
->in(__DIR__.'/routes');
->in(__DIR__.'/routes')
->in(__DIR__.'/tests');

return (new Config())
->setFinder($finder)
Expand Down
1 change: 0 additions & 1 deletion .styleci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ preset: laravel
finder:
not-name:
- index.php
- server.php
2 changes: 1 addition & 1 deletion app/Azuriom.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Azuriom
*
* @var string
*/
private const VERSION = '0.5.1';
private const VERSION = '1.0.0';

/**
* Get the current version of Azuriom CMS.
Expand Down
3 changes: 2 additions & 1 deletion app/Console/Commands/PluginCreateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,12 @@ private function createPluginJson(string $path, string $id, string $name, string
'authors' => [
$this->option('author'),
],
'azuriom_api' => '1.0.0',
'providers' => [
"\\{$namespace}\\Providers\\{$className}ServiceProvider",
"\\{$namespace}\\Providers\\RouteServiceProvider",
],
], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
], JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
}

private function createComposerJson(string $path, string $id, string $namespace)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,5 @@
@section('title', 'Plugin home')

@section('content')
<div class="container content">
<p>This is the demo page of your plugin.</p>
</div>
<p>This is the demo page of your plugin.</p>
@endsection
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class DummyPluginServiceProvider extends BasePluginServiceProvider
*
* @var array
*/
protected $middleware = [
protected array $middleware = [
// \DummyNamespace\Middleware\ExampleMiddleware::class,
];

Expand All @@ -20,14 +20,14 @@ class DummyPluginServiceProvider extends BasePluginServiceProvider
*
* @var array
*/
protected $middlewareGroups = [];
protected array $middlewareGroups = [];

/**
* The plugin's route middleware.
*
* @var array
*/
protected $routeMiddleware = [
protected array $routeMiddleware = [
// 'example' => \DummyNamespace\Middleware\ExampleRouteMiddleware::class,
];

Expand All @@ -36,7 +36,7 @@ class DummyPluginServiceProvider extends BasePluginServiceProvider
*
* @var array
*/
protected $policies = [
protected array $policies = [
// User::class => UserPolicy::class,
];

Expand Down
4 changes: 1 addition & 3 deletions app/Extensions/ExtensionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ abstract class ExtensionManager
{
/**
* The filesystem instance.
*
* @var \Illuminate\Filesystem\Filesystem
*/
protected $files;
protected Filesystem $files;

/**
* Create a new ExtensionManager instance.
Expand Down
2 changes: 1 addition & 1 deletion app/Extensions/Plugin/AdminDashboardCardComposer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ abstract class AdminDashboardCardComposer
* Get the cards to add to the admin dashboard.
* Each card should contains:
* - 'color' : A Bootstrap color (e.g: success)
* - 'icon' : A FontAwesome 5 icon (e.g: fas fa-rocket)
* - 'icon' : A Bootstrap icon (e.g: bi bi-chat)
* - 'name' : The name of the card
* - 'value' : The value of the card.
*
Expand Down
29 changes: 18 additions & 11 deletions app/Extensions/Plugin/BasePluginServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Azuriom\Extensions\Plugin;

use Illuminate\Contracts\Http\Kernel;
use Illuminate\Routing\Router;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\ServiceProvider;

Expand All @@ -15,14 +16,14 @@ abstract class BasePluginServiceProvider extends ServiceProvider
*
* @var array
*/
protected $middleware = [];
protected array $middleware = [];

/**
* The plugin's route middleware groups.
*
* @var array
*/
protected $middlewareGroups = [];
protected array $middlewareGroups = [];

/**
* The plugin's route middleware.
Expand All @@ -31,21 +32,21 @@ abstract class BasePluginServiceProvider extends ServiceProvider
*
* @var array
*/
protected $routeMiddleware = [];
protected array $routeMiddleware = [];

/**
* The policy mappings for this plugin.
*
* @var array
*/
protected $policies = [];
protected array $policies = [];

/**
* The router instance.
*
* @var \Illuminate\Routing\Router
* @var \Illuminate\Routing\Router|null
*/
protected $router;
protected Router|null $router;

/**
* Register any plugin services.
Expand Down Expand Up @@ -94,17 +95,23 @@ protected function loadMigrations()

protected function registerRouteDescriptions()
{
$this->app['plugins']->addRouteDescription($this->routeDescriptions());
$this->app['plugins']->addRouteDescription(function () {
return $this->routeDescriptions();
});
}

protected function registerAdminNavigation()
{
$this->app['plugins']->addAdminNavItem($this->adminNavigation());
$this->app['plugins']->addAdminNavItem(function () {
return $this->adminNavigation();
});
}

protected function registerUserNavigation()
{
$this->app['plugins']->addUserNavItem($this->userNavigation());
$this->app['plugins']->addUserNavItem(function () {
return $this->userNavigation();
});
}

protected function middleware($middleware, bool $before = false)
Expand All @@ -120,7 +127,7 @@ protected function middleware($middleware, bool $before = false)
}
}

protected function middlewareGroup($name, $middleware = null)
protected function middlewareGroup(string|array $name, $middleware = null)
{
$middlewares = is_array($name) ? $name : [$name => $middleware];

Expand All @@ -129,7 +136,7 @@ protected function middlewareGroup($name, $middleware = null)
}
}

protected function routeMiddleware($name, $middleware = null)
protected function routeMiddleware(string|array $name, $middleware = null)
{
$middlewares = is_array($name) ? $name : [$name => $middleware];

Expand Down
13 changes: 1 addition & 12 deletions app/Extensions/Plugin/HasPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,10 @@ trait HasPlugin
*
* @var mixed
*/
protected $plugin;

/**
* The associated plugin name.
*
* @var string
*
* @deprecated Use $plugin->id instead. Will be removed in Azuriom 1.0
*/
// TODO 1.0: Remove deprecated variable
protected $pluginName;
protected mixed $plugin;

public function bindPlugin($plugin)
{
$this->plugin = $plugin;
$this->pluginName = $plugin->id;
}
}
Loading

0 comments on commit e0f1f8e

Please sign in to comment.