feat: Add user level and experience attributes, and implement reward, task, and quest models with corresponding controllers and migrations
This commit is contained in:
parent
aa50740dcb
commit
fd20278948
17 changed files with 963 additions and 112 deletions
22
backend/app/Http/Controllers/RewardController.php
Normal file
22
backend/app/Http/Controllers/RewardController.php
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Reward;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class RewardController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$rewards = Reward::all();
|
||||
return response()->json($rewards);
|
||||
}
|
||||
|
||||
public function unlocked(Request $request)
|
||||
{
|
||||
$user = $request->user();
|
||||
$unlocked = $user->belongsToMany(Reward::class, 'reward_user')->get();
|
||||
return response()->json($unlocked);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue