简体   繁体   中英

Implementing REST API with Laravel Voyager Admin Package

I am creating a CMS using Laravel Voyager Package ( https://voyager.readme.io/docs/ ) and have successfully installed it, now I need to use the content to generate pages in my mobile apps and for this, I need to implement REST APIs in my Laravel project and Voyager do not come with any support for REST APIs.

I am not able to find how can I interact with POSTS table using REST API in this package because of the files for database and controller are inside /vendor/tcg directory.

Please help me.

Thanks in advance.

Late answer but for anyone who comes across,

You need to install laravel Pasport, https://laravel.com/docs/5.8/passport follow the installation instruction up to app/config.php,

then add your routes in routes/api.php like this :


Route::group([
    'middleware' => 'auth:api'
], function () {
    Route::get('anypage', 'AnypageController@index');
    Route::get('anotherpage/{updated_at}', 'MerchantController@another');
// add any routes
});

that's it you are up and running, test with postman. you need to understand more about how Passport works, .

Another late answer but while googling and finding this topic it works with using Orion package for rest routes. Make sure to create models in voyager. https://tailflow.github.io/laravel-orion-docs/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM