my first commit

This commit is contained in:
root
2025-11-19 15:18:35 +00:00
commit 9c85a9d0c8
97 changed files with 13637 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
<?php
namespace App\Http\Controllers;
use App\Models\Candidate;
use Illuminate\Http\Request;
class CandidatesController extends Controller
{
public function index()
{
return response()->json(Candidate::all()->toJSON());
}
public function show($id)
{
$candidate = Candidate::friend($id);
if ($candidate) {
return response()->json($candidate->toArray());
} else {
return response()->json(['message' => 'Кандидант не найден'], 404);
}
}
public function create(Request $request)
{
$title = $request->get(key:'title');
$description = $request->get(key:'description');
$creatorUser = 1;
$candidate = new Candidate();
$candidate->title = $title;
$candidate->description =$description;
$candidate->craetor_user_id =$creatorUser;
$candidate->save();
return response()->json($candidate->toJson());
}
}

View File

@@ -0,0 +1,10 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class CandidatsController extends Controller
{
//
}

View File

@@ -0,0 +1,8 @@
<?php
namespace App\Http\Controllers;
abstract class Controller
{
//
}

10
app/Models/Candidate.php Normal file
View File

@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Candidate extends Model
{
}

48
app/Models/User.php Normal file
View File

@@ -0,0 +1,48 @@
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable
{
/** @use HasFactory<\Database\Factories\UserFactory> */
use HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $fillable = [
'name',
'email',
'password',
];
/**
* The attributes that should be hidden for serialization.
*
* @var list<string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
//
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
//
}
}