Compare commits

..

3 Commits

Author SHA1 Message Date
998ed25315 Add web routes: user CRUD & root path 2024-10-17 04:54:30 +10:00
6f41446d55 Init UserController 2024-10-17 04:53:02 +10:00
75fa64b14f Remove User email field 2024-10-17 04:51:52 +10:00
3 changed files with 63 additions and 10 deletions

View File

@ -0,0 +1,53 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class UserController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
//
return response("Get all users");
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
return response("User store with data: " . $request->json());
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
return response("User with id " . $id);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
//
return response("Update user " . $id);
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
return response("Destroy user " . $id);
}
}

View File

@ -10,20 +10,12 @@ public function up(): void
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('name')->unique();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
Schema::create('password_reset_tokens', function (Blueprint $table) {
$table->string('email')->primary();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
Schema::create('sessions', function (Blueprint $table) {
$table->string('id')->primary();
$table->foreignId('user_id')->nullable()->index();
@ -37,7 +29,6 @@ public function up(): void
public function down(): void
{
Schema::dropIfExists('users');
Schema::dropIfExists('password_reset_tokens');
Schema::dropIfExists('sessions');
}
};

View File

@ -1 +1,10 @@
<?php
use App\Http\Controllers\UserController;
use Illuminate\Support\Facades\Route;
Route::resource('user', UserController::class);
Route::get('/', function () {
return response('Simple blog API. In develop...');
});