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')); }
/** * Display a listing of posts. * * @return \Illuminate\Http\Response */ public function index() { $authors = Author::all(); return response()->json($authors); }