-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added factory, controller, seeder, actions, migration on make m…
…odel console command
- Loading branch information
Showing
17 changed files
with
196 additions
and
86 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright 2021 - N'Guessan Kouadio Elisée ([email protected]) | ||
* @license MIT (https://opensource.org/licenses/MIT) | ||
* @link https://github.com/eliseekn/tinymvc | ||
*/ | ||
|
||
namespace App\Http\Controllers\Auth; | ||
|
||
use Core\Support\Auth; | ||
use Core\Support\Alert; | ||
use Core\Http\Response\Response; | ||
|
||
class LogoutController | ||
{ | ||
public function __invoke(Response $response) | ||
{ | ||
Auth::forget(); | ||
|
||
Alert::toast(__('logged_out'))->success(); | ||
$response->redirect()->to(Auth::HOME)->go(); | ||
} | ||
} |
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,45 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright 2021 - N'Guessan Kouadio Elisée ([email protected]) | ||
* @license MIT (https://opensource.org/licenses/MIT) | ||
* @link https://github.com/eliseekn/tinymvc | ||
*/ | ||
|
||
namespace App\Http\Controllers\Auth; | ||
|
||
use Core\Http\Request; | ||
use Core\Support\Auth; | ||
use Core\Support\Alert; | ||
use Core\Support\Session; | ||
use App\Mails\WelcomeMail; | ||
use Core\Support\Mailer\Mailer; | ||
use Core\Http\Response\Response; | ||
use App\Http\Actions\UserActions; | ||
use App\Http\Validators\Auth\RegisterValidator; | ||
|
||
class RegisterController | ||
{ | ||
public function index(Request $request, Response $response) | ||
{ | ||
if (!Auth::check($request)) $response->view('auth.signup'); | ||
|
||
$uri = !Session::has('intended') ? Auth::HOME : Session::pull('intended'); | ||
$response->redirect()->to($uri)->go(); | ||
} | ||
|
||
public function register(Request $request, Mailer $mailer, Response $response) | ||
{ | ||
RegisterValidator::make($request->inputs())->redirectBackOnFail($response); | ||
$user = UserActions::create($request->inputs()); | ||
|
||
if (!config('security.auth.email_verification')) { | ||
WelcomeMail::send($mailer, $user->email, $user->name); | ||
|
||
Alert::default(__('account_created'))->success(); | ||
$response->redirect()->to('login')->go(); | ||
} | ||
|
||
$response->redirect()->to('email/notify')->go(); | ||
} | ||
} |
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
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.