Installation
composer require nikservik/simple-support
php artisan vendor:publish --tag="simple-support-migrations"
php artisan vendor:publish --tag="simple-support-config"
php artisan migrate
Publish Config
Edit config/simple-support.php to enable features (e.g., 'user-can-send-message').
First Use Case: Sending a System-Wide Notification
use Nikservik\SimpleSupport\Facades\Support;
// Send a broadcast message to all users
Support::notifyAll('System Maintenance', 'The site will be down for 1 hour.');
First Use Case: User Support Dialog
// Start a conversation with a user (assuming User model has `supportConversations()`)
$conversation = auth()->user()->supportConversations()->create([
'subject' => 'Technical Issue',
'message' => 'My app is crashing.'
]);
User-Initiated Support Requests
Supportable trait to users/models needing support access.hasSupportConversations() relationship in your User model:
public function supportConversations()
{
return $this->hasMany(\Nikservik\SimpleSupport\Models\Conversation::class);
}
Admin Dashboard Integration
php artisan vendor:publish --tag="simple-support-views"
routes/simple-support.php after publishing).Broadcast Notifications
Support::notifyAll() for system-wide alerts:
Support::notifyAll('News', 'Check out our new feature!', ['url' => '/new-feature']);
resources/views/vendor/simple-support/.API Endpoints
GET /api/support/conversations.POST /api/support/conversations/{id}/replies.auth or custom middleware:
Route::middleware(['auth', 'can:access-support'])->group(function () {
// Support routes
});
SupportConversationCreated or SupportMessageSent events:
event(new SupportConversationCreated($conversation));
SupportNotification class to customize email/SMS templates.Migration Conflicts
autoload-migrations is enabled in config, ensure no duplicate tables exist (e.g., conversations, messages).database/migrations/ for conflicts before running migrate.Feature Flags
'user-can-send-message') requires commenting out the line in config/simple-support.php. Uncommenting re-enables it.'features' => [
env('SUPPORT_USER_MESSAGES', 'user-can-send-message'),
],
GitHub OAuth Misconfiguration
github-oauth config in composer.json is unused in the package (likely a leftover). Ignore it unless the package evolves to use GitHub auth.Translation Strings
php artisan vendor:publish --tag="simple-support-translations"
resources/lang/en/simple-support.php.Logs: Enable debug mode in config/simple-support.php:
'debug' => env('APP_DEBUG', false),
Logs appear in storage/logs/laravel.log.
Database Issues:
php artisan db:seed --class=SupportTableSeeder if test data is missing.php artisan tinker
>>> \Nikservik\SimpleSupport\Models\Conversation::all();
Custom Models
AppServiceProvider:
$this->app->bind(
\Nikservik\SimpleSupport\Models\Conversation::class,
\App\Models\CustomConversation::class
);
API Responses
SupportController to modify responses:
use Nikservik\SimpleSupport\Http\Controllers\SupportController as BaseController;
class CustomSupportController extends BaseController {
public function showConversation($id) {
$data = parent::showConversation($id);
$data['custom_field'] = 'value';
return response()->json($data);
}
}
Webhooks
SupportMessageSent events to trigger external actions (e.g., Slack):
SupportMessageSent::subscribe(function ($event) {
// Send to Slack/other service
});
Rate Limiting
app/Http/Kernel.php:
'api' => [
\Illuminate\Routing\Middleware\ThrottleRequests::class.':api',
\Nikservik\SimpleSupport\Http\Middleware\LimitSupportRequests::class,
],
How can I help you explore Laravel packages today?