예제 #1
0
 public function edit($id)
 {
     $post = Post::with('author', 'fields', 'category', 'tags')->findOrFail($id);
     $post->lock(auth()->user()->id);
     $categories = Category::all(['id', 'name']);
     $tags = Tag::all(['id', 'name']);
     $authors = Author::all(['id', 'name']);
     $fields = Field::all();
     return view('admin::posts.edit', compact('post', 'categories', 'tags', 'authors', 'fields'));
 }
예제 #2
0
 /**
  * Display a listing of posts.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $authors = Author::all();
     return response()->json($authors);
 }