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

them middleware auth

parent ba56bc93
......@@ -3,22 +3,26 @@
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Post;
class PostController extends Controller
{
public function index(Request $request) {
return view('post.index');
}
public function ajax(Request $request) {
return view('post.ajax');
}
public function create(Request $request) {
return view('post.index');
}
public function edit($id, Request $request) {
public function edit(Post $post, Request $request) {
return view('post.index');
}
public function store(Request $request) {
return view('post.index');
}
public function update($id, Request $request) {
public function update(Post $post, Request $request) {
return view('post.index');
}
public function destroy($id, Request $request) {
......
......@@ -18,6 +18,10 @@
*/
Auth::routes();
Route::resource('posts', PostController::class);
Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');
Route::middleware(['auth'])->group(function() {
Route::resource('posts', PostController::class);
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