10 months ago

Undefined variable: category

Posted 10 months ago by irankhosravi

I use below link

I'm working on a Laravel (v 5.7) project and i did the form to manage categories. Currently, i can create a new category and i would be able to delete.

I created the view (with blade) to delete the categories :

<form action="{{ route('categories.destroy', ['id' => $category->id]) }}" method="post">
    {{ method_field('delete') }}
    <div class="form-group">
        <label for="categories">Category:</label>
        <select name="{{ category->id }}">{{ category->name }}</select>
    <div class="form-group">
        <button type="button" class="btn btn-danger">Delete</button>

And in the routing file web.php, I wrote :

Route::group(['namespace' => 'Admin', 'prefix' => 'admin'],function (){
    $this->resource('categories', 'CategoryController');

Now I want to select a category from the list and delete it, How to work with vue.js

But I get this error

Undefined variable: category (View: C:\xampp\htdocs\project\divar\resources\views\Admin\categories\index.blade.php)

Please sign in or create an account to participate in this conversation.