Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Github/Database/.DS_Store
Jira/*
vendor
File renamed without changes.
70 changes: 70 additions & 0 deletions Console/InstallCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?php

namespace Modules\Github\Console;

use App\Misc\Helper;
use Illuminate\Console\Command;
use Nwidart\Modules\Facades\Module;

class InstallCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'freescout-github:install {--force : Force the operation to run when in production}';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Run the database migrations for the FreeScout GitHub module.';

/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$moduleName = 'Github';

$module = Module::find($moduleName);

if (!$module) {
$this->error('The GitHub module is not registered.');

return 1;
}

$this->info('Running migrations for the GitHub module...');

$parameters = ['module' => $moduleName];

$force = $this->option('force');

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

try {
$exitCode = $this->call('module:migrate', $parameters);
} catch (\Throwable $exception) {
$this->error('Running GitHub module migrations failed: '.$exception->getMessage());
Helper::logException($exception, '[GitHub] install command');

return 1;
}

if ($exitCode === 0) {
$this->info('GitHub module migrations completed successfully.');
} else {
$this->error('GitHub module migrations finished with errors.');
}

return $exitCode;
}
}

File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Modules\Github\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Route;
use Modules\Github\Console\InstallCommand;

// Module alias
define('GITHUB_MODULE', 'github');
Expand All @@ -23,6 +23,10 @@ public function boot()
$this->loadMigrations();
$this->registerHooks();
$this->loadAssets();

if ($this->app->runningInConsole()) {
$this->registerCommands();
}
}

/**
Expand Down Expand Up @@ -88,14 +92,30 @@ protected function registerHooks()
{
// Add module's CSS file to the application layout
\Eventy::addFilter('stylesheets', function($styles) {
$styles[] = \Module::getPublicPath(GITHUB_MODULE).'/css/module.css';
$cssPath = \Module::getPublicPath(GITHUB_MODULE).'/css/module.css';
if (file_exists(public_path($cssPath))) {
$styles[] = $cssPath;
} else {
\Log::warning('[GitHub] Public CSS asset not found: '.public_path($cssPath));
}
return $styles;
});

// Add module's JS file to the application layout
\Eventy::addFilter('javascripts', function($javascripts) {
$javascripts[] = \Module::getPublicPath(GITHUB_MODULE).'/js/laroute.js';
$javascripts[] = \Module::getPublicPath(GITHUB_MODULE).'/js/module.js';
$jsFiles = [
\Module::getPublicPath(GITHUB_MODULE).'/js/laroute.js',
\Module::getPublicPath(GITHUB_MODULE).'/js/module.js',
];

foreach ($jsFiles as $jsPath) {
if (file_exists(public_path($jsPath))) {
$javascripts[] = $jsPath;
} else {
\Log::warning('[GitHub] Public JS asset not found: '.public_path($jsPath));
}
}

return $javascripts;
});

Expand Down Expand Up @@ -187,4 +207,16 @@ protected function loadAssets()
{
// Assets are loaded via Eventy filters in registerHooks()
}

/**
* Register Artisan commands provided by the module.
*
* @return void
*/
protected function registerCommands()
{
$this->commands([
InstallCommand::class,
]);
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
21 changes: 18 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,27 @@ A comprehensive GitHub integration module for FreeScout that enables support tea
composer install --no-dev
```

3. **Run database migrations**:
3. **Enable the module** (from your FreeScout project root). Skip if already enabled in the UI:
```bash
php artisan migrate
php artisan module:enable Github
```

4. **Configure the module** via FreeScout Admin → Settings → GitHub
4. **Refresh FreeScout caches** so the module command is registered:
```bash
php artisan freescout:clear-cache
```

5. **Clear application cache** so Laravel registers the Github commands
```bash
php artisan cache:clear
```

6. **Run the module installation command** to execute this module's migrations:
```bash
php artisan freescout-github:install
```

7. **Configure the module** via FreeScout Admin → Settings → GitHub

## ⚙️ Configuration

Expand Down
File renamed without changes.
File renamed without changes.
18 changes: 18 additions & 0 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
5 changes: 0 additions & 5 deletions Github/start.php → start.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@
* to create, link, and track GitHub issues directly from support conversations.
*/

// Register the module with FreeScout
if (!defined('GITHUB_MODULE')) {
define('GITHUB_MODULE', true);
}

// Load module routes when running as a standalone FreeScout module
if (class_exists('\Route')) {
require __DIR__ . '/Http/routes.php';
Expand Down