Skip to content

Commit

Permalink
feat: add files
Browse files Browse the repository at this point in the history
  • Loading branch information
deniskorbakov committed Oct 26, 2024
1 parent beb5292 commit 460547b
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 8 deletions.
33 changes: 33 additions & 0 deletions app/Http/Controllers/Api/UserController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

declare(strict_types=1);

namespace App\Http\Controllers\Api;

use App\Models\User;
use App\Services\Api\UserService;

class UserController extends Controller
{
public function __construct(
protected UserService $userService
) {
}

public function show(int $id): array
{
return User::query()->findOrFail($id)?->toArray();
}

public function update()
{
}

public function team()
{
}

public function challenge()
{
}
}
2 changes: 0 additions & 2 deletions app/Models/Achievement.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ class Achievement extends Model
{
use HasFactory;

public $timestamps = true;

protected $fillable = [
'name',
'description',
Expand Down
9 changes: 3 additions & 6 deletions app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;

class User extends Authenticatable implements FilamentUser
{
use HasFactory, Notifiable;
use HasFactory, Notifiable, HasApiTokens;

public $timestamps = true;

Expand Down Expand Up @@ -67,10 +68,6 @@ protected function casts(): array

public function canAccessPanel(Panel $panel): bool
{
if ($this->is_admin) {
return true;
}

return false;
return (bool) $this->is_admin;
}
}
24 changes: 24 additions & 0 deletions app/Services/Api/UserService.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

namespace App\Services\Api;

class UserService
{
public function show()
{
}

public function update()
{
}

public function team()
{
}

public function challenge()
{
}
}
1 change: 1 addition & 0 deletions routes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@

Route::post('register', [AuthController::class, 'register'])->name('auth.register');
Route::post('auth', [AuthController::class, 'auth'])->name('auth.auth');

0 comments on commit 460547b

Please sign in to comment.