Hoschis Vollpfosten First Commit
This commit is contained in:
parent
b52a6fade5
commit
0736ecf29f
112 changed files with 9777 additions and 0 deletions
38
pfosten/app/Http/Controllers/SessionsController.php
Normal file
38
pfosten/app/Http/Controllers/SessionsController.php
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class SessionsController extends Controller
|
||||
{
|
||||
|
||||
function __construct() {
|
||||
$this->middleware('guest', ['except' => 'destroy']); // Filter: Only guests = not logged in users are allowed. Everybody else is redirected away.
|
||||
}
|
||||
|
||||
|
||||
public function create() {
|
||||
return view('sessions.create');
|
||||
}
|
||||
public function store() {
|
||||
// Attempt to authenticate the user
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (!auth()->attempt(request(['name','password']))) {
|
||||
return back()->withErrors(['message'=>'Bitte Logindaten prüfen und nochmal versuchen.']);
|
||||
}
|
||||
|
||||
|
||||
// And redirect to home page
|
||||
return redirect()->home();
|
||||
|
||||
}
|
||||
public function destroy() {
|
||||
auth()->logout();
|
||||
return redirect()->home();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue