1. Go to this page and download the library: Download edulazaro/larawards 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/ */
edulazaro / larawards example snippets
php artisan migrate
php artisan make:award FooAchievement
/** @var string The award type. */
public $type = 'achievement';
namespace App\Awards;
use EduLazaro\Larawards\Concerns\IsAward;
use EduLazaro\Larawards\Contracts\AwardInterface;
use App\Events\AchievementUnlocked;
class CommentsAchievement implements AwardInterface
{
use IsAward;
// ...
protected string $event = AchievementUnlocked::class;
// ...
}
use EduLazaro\Larawards\Models\Reward;
// ...
Reward::where('award_id', 'comments_achievement')->get();
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use EduLazaro\Larawards\Collections\Awards;
use App\Awards\CommentsAchievement;
use App\Awards\LikesAchievement;
class AwardServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*/
public function boot(): void
{
Awards::enforceMap([
'comments_achievement' => CommentsAchievement::class,
'likes_achievement' => LikesAchievement::class,
]);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.