Estoy avanzando en el adminpanel
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Post;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class AdminController extends Controller
|
||||
@@ -10,4 +11,9 @@ class AdminController extends Controller
|
||||
{
|
||||
return view('admin.index');
|
||||
}
|
||||
|
||||
public function posts()
|
||||
{
|
||||
return view('admin.posts.index', ['posts' => Post::all()]);
|
||||
}
|
||||
}
|
||||
|
||||
36
app/Http/Controllers/PostController.php
Normal file
36
app/Http/Controllers/PostController.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Post;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class PostController extends Controller
|
||||
{
|
||||
public function create()
|
||||
{
|
||||
return view('admin.posts.create');
|
||||
}
|
||||
|
||||
public function save(Request $request)
|
||||
{
|
||||
$post = new Post();
|
||||
$post->title = $request->title;
|
||||
$post->md = $request->md;
|
||||
$post->save();
|
||||
|
||||
return redirect()->route('admin.post.index');
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
}
|
||||
|
||||
public function update($id)
|
||||
{
|
||||
}
|
||||
|
||||
public function delete($id)
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user