Skip to content

Commit

Permalink
new file: app/Http/Controllers/AuthController.php
Browse files Browse the repository at this point in the history
	new file:   app/Http/Controllers/TestController.php
	new file:   app/Http/Controllers/UserController.php
	new file:   app/Http/Requests/UserDetailsRequest.php
	new file:   composer.lock
	modified:   resources/views/welcome.blade.php
	modified:   routes/web.php
  • Loading branch information
cjeccles committed Nov 12, 2023
1 parent 024c86a commit 2c84159
Show file tree
Hide file tree
Showing 7 changed files with 8,253 additions and 138 deletions.
65 changes: 65 additions & 0 deletions app/Http/Controllers/AuthController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?php

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

class AuthController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
//
}

/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}

/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}

/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}

/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}

/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
//
}

/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}
22 changes: 22 additions & 0 deletions app/Http/Controllers/TestController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

class TestController extends Controller
{
function showAboutPage(Request $request) {
return "Hello via Controller>Function";
}

function showAboutDetails($user) {
$person = [
"name" => $user,
"email" => "[email protected]"
];

return response()->json($person);
}
}
15 changes: 15 additions & 0 deletions app/Http/Controllers/UserController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Http\Requests\UserDetailsRequest;

class UserController extends Controller
{
public function register(UserDetailsRequest $request)
{
return "User created with email: {$request->email}";
}
}
40 changes: 40 additions & 0 deletions app/Http/Requests/UserDetailsRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class UserDetailsRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}

/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
"email" => ['required', 'email:rfc,dns'],
"password" => ['required', 'min:6', 'max:12', '']
];
}

public function messages(): array
{
return [
"email.required" => "Please enter your email",
"email.email" => "Please enter a real email address",
"password.required" => "Please enter a pa55word",
"password.min" => "You must enter at least 6 characters for your password, please :)",
"password.max" => "Oops, your password is too long!"
];
}
}
Loading

0 comments on commit 2c84159

Please sign in to comment.