Bagisto Forum

    Bagisto

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Define route: admin.blog.index in web.php

    General Discussion
    2
    2
    87
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • W
      WatersSea last edited by

      Good day,

      I am working through devdocs to create a custom package.

      ON:

      https://devdocs.bagisto.com/master/packages/datagrid.html#setting-up-datagrid

      there is a statement:

      "Make sure the route admin.blog.index is defined in your web.php file, so that it points to the index method of the PostController:"

      How do I do that?

      Thanks

      1 Reply Last reply Reply Quote 0
      • Rishabh-Webkul
        Rishabh-Webkul last edited by

        Hello @WatersSea

        We have created a video tutorial of how to create a module. In that video, we have created module of the Stock Notification with the help of Official dev Docs through Package Development in Detail.

        Hope this will help you to resolve your query.

        Youtube Tutorial Link - https://youtu.be/PIjIxtgzOJk?si=bntwsL-pE_j5itb7

        And regarding your query.

        Route::prefix('admin'): This sets the route prefix to admin, so your route will be admin/blog.

        Route::name('admin.'): This sets the route name prefix to admin., so your route name will be admin.blog.index.

        middleware('auth'): This middleware ensures that the route is protected and only accessible to authenticated users. Adjust this based on your needs.

        Route::get('blog', [PostController::class, 'index'])->name('blog.index');: This defines a GET request to the blog URL, which maps to the index method of PostController, and names the route.

        admin.blog.index.
        Make sure that the PostController exists and has an index method defined. If it’s part of a package or module in Bagisto, ensure you adjust the namespace and paths according to your application structure.

        This route setup will create a URL like /admin/blog that maps to the index method of the PostController, and you can refer to this route as admin.blog.index in your application.

        Thanks & Regards

        1 Reply Last reply Reply Quote 0
        • First post
          Last post