PHP code example of a2zwebltd / laravel-feature-voting
1. Go to this page and download the library: Download a2zwebltd/laravel-feature-voting library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
a2zwebltd / laravel-feature-voting example snippets
// app/Providers/AppServiceProvider.php — boot()
use Illuminate\Support\Facades\Gate;
use App\Models\User;
Gate::define('manage-feature-requests', function (User $user) {
return in_array($user->email, ['[email protected]']);
// or $user->is_admin, or a role check, etc.
});
'views' => [
'layout' => 'layouts.app', // your existing layout
'section' => 'content', // the @yield name inside it
],
use A2ZWeb\FeatureVoting\Services\FeatureVotingService;
use A2ZWeb\FeatureVoting\Enums\FeatureRequestStatus;
$service = app(FeatureVotingService::class);
$request = $service->submit($user, 'Add Slack export', 'Would love this');
$service->toggleVote($user, $request);
$service->comment($user, $request, 'Same here!');
$service->updateStatus($admin, $request, FeatureRequestStatus::Planned, 'Targeting Q3');
$service->isAdmin($user);
use A2ZWeb\FeatureVoting\Events\FeatureRequestCreated;
use Illuminate\Support\Facades\Event;
Event::listen(FeatureRequestCreated::class, function ($event) {
// ping Slack, create a JIRA ticket, etc.
});