Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
P
Project_Laravel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
TTS Nguyen Huu Huan
Project_Laravel
Commits
5f2daa6d
Commit
5f2daa6d
authored
Sep 11, 2022
by
Trung Lê Đình
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
them middleware auth
parent
ba56bc93
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
+13
-5
PostController.php
app/Http/Controllers/PostController.php
+6
-2
web.php
routes/web.php
+7
-3
No files found.
app/Http/Controllers/PostController.php
View file @
5f2daa6d
...
@@ -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
)
{
...
...
routes/web.php
View file @
5f2daa6d
...
@@ -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'
);
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment