-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(global): Adding Larastan + refactor user module using SOLID
- Fix some phpstan issues - Fix user save
- Loading branch information
Showing
18 changed files
with
413 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Http\Controllers\User; | ||
|
||
use App\Models\User; | ||
use Illuminate\Http\Request; | ||
use Illuminate\View\View; | ||
|
||
class UserCreateController | ||
{ | ||
public function create(Request $request): View | ||
{ | ||
$data['user'] = new User(); | ||
|
||
return view('user.user', $data); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\User; | ||
|
||
use App\Models\User; | ||
use Illuminate\Http\Request; | ||
use Illuminate\View\View; | ||
|
||
class UserIndexController | ||
{ | ||
public function index(Request $request): View | ||
{ | ||
$data['users'] = User::all(); | ||
|
||
return view('user.index', $data); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Http\Controllers\User; | ||
|
||
use App\Http\Controllers\MainController; | ||
use App\Models\User; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Hash; | ||
|
||
class UserSaveController extends MainController | ||
{ | ||
public function save(Request $request) | ||
{ | ||
if (empty($request->id)) { | ||
$user = new User(); | ||
$user->created_at = now(); | ||
} else { | ||
$user = User::find($request->id); | ||
} | ||
$user->name = $request->name; | ||
$user->email = $request->email; | ||
if (! empty($request->password)) { | ||
$user->password = Hash::make($request->password); | ||
} | ||
$user->updated_at = now(); | ||
$user->save(); | ||
|
||
return redirect('/user'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\User; | ||
|
||
use App\Models\User; | ||
use Illuminate\Http\Request; | ||
|
||
class UserUpdateController | ||
{ | ||
public function update(Request $request, int $id) | ||
{ | ||
$data['user'] = User::find($id); | ||
|
||
return view('user.user', $data); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.