5

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.

Sanny Srivastava
  • 1,137
  • 1
  • 13
  • 24

2 Answers2

2

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, .

Salah
  • 59
  • 1
  • 1
  • 4
1

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/

Patrik Grinsvall
  • 584
  • 1
  • 4
  • 22