Basic routes and BeerListController methods
This commit is contained in:
@@ -26,7 +26,7 @@ class ConfirmPasswordController extends Controller
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
protected $redirectTo = RouteServiceProvider::PROFILE;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
|
||||
@@ -26,7 +26,7 @@ class LoginController extends Controller
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
protected $redirectTo = RouteServiceProvider::PROFILE;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
|
||||
@@ -29,7 +29,7 @@ class RegisterController extends Controller
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
protected $redirectTo = RouteServiceProvider::PROFILE;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
|
||||
@@ -26,5 +26,5 @@ class ResetPasswordController extends Controller
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
protected $redirectTo = RouteServiceProvider::PROFILE;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ class VerificationController extends Controller
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
protected $redirectTo = RouteServiceProvider::PROFILE;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
|
||||
@@ -2,9 +2,35 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\BeerList;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class BeerListController extends Controller
|
||||
{
|
||||
//
|
||||
public function show(BeerList $list)
|
||||
{
|
||||
|
||||
return view('list.show', compact('list'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return view('list.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$this->validate($request, [
|
||||
'title' => 'required',
|
||||
]);
|
||||
|
||||
$list = new BeerList;
|
||||
$list->title = $request->title;
|
||||
$list->user_id = auth()->user()->id;
|
||||
|
||||
$list->save();
|
||||
|
||||
return redirect('/profile');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the application dashboard.
|
||||
*
|
||||
* @return \Illuminate\Contracts\Support\Renderable
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('home');
|
||||
}
|
||||
}
|
||||
19
app/Http/Controllers/UserController.php
Normal file
19
app/Http/Controllers/UserController.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
public function index(User $user)
|
||||
{
|
||||
return view('profile', compact('user'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user