Commit 5f2daa6d authored by Trung Lê Đình's avatar Trung Lê Đình

them middleware auth

parent ba56bc93
...@@ -3,22 +3,26 @@ ...@@ -3,22 +3,26 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Models\Post;
class PostController extends Controller class PostController extends Controller
{ {
public function index(Request $request) { public function index(Request $request) {
return view('post.index'); return view('post.index');
} }
public function ajax(Request $request) {
return view('post.ajax');
}
public function create(Request $request) { public function create(Request $request) {
return view('post.index'); return view('post.index');
} }
public function edit($id, Request $request) { public function edit(Post $post, Request $request) {
return view('post.index'); return view('post.index');
} }
public function store(Request $request) { public function store(Request $request) {
return view('post.index'); return view('post.index');
} }
public function update($id, Request $request) { public function update(Post $post, Request $request) {
return view('post.index'); return view('post.index');
} }
public function destroy($id, Request $request) { public function destroy($id, Request $request) {
......
...@@ -18,6 +18,10 @@ ...@@ -18,6 +18,10 @@
*/ */
Auth::routes(); Auth::routes();
Route::resource('posts', PostController::class); Route::middleware(['auth'])->group(function() {
Route::resource('posts', PostController::class);
Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home'); Route::prefix('posts')->name('posts.')->group(function() {
Route::post('ajax', [PostController::class, 'ajax'])->name('ajax');
});
Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment