In this lesson, we will create a dropdown select to pick from a list of categories. For this, we will create a new composable and a new API endpoint with the API Resource.

Let's start this lesson by creating a Controller with the API route.
php artisan make:controller Api/CategoryControllerphp artisan make:resource CategoryResource
app/Http/Controllers/Api/CategoryController.php:
use App\Http\Resources\CategoryResource; class CategoryController extends Controller{ public function index() { return CategoryResource::collection(Category::all()); }}
routes/api.php:
Route::get('posts', [PostController::class, 'index']);Route::get('categories', [CategoryController::class, 'index']);
In the Resource, we will only add...
You have added this line as a new line const 'selectedCategory = ref('')'... And you missed highlighting it... I assume povillas did not do that mistake, may be some of his team member did... But please keep in mind for a new learner like me, it becomes so much annoying... Please do not ignore these little things
Thanks for the report. Don't forget that we are all humans and make mistakes :) look at it this way, you get an error or something doesn't work then you debug, it's a learning process! ;) good luck learning.
Yes, in fact I was thinking that maybe all the things you dont mention in the course is to force us find the solution ourselves so we can grasp better the key concepts and little traps of the development process. Thanks guys. Great work.