tuandm / laravue

Admin dashboard for enterprise Laravel applications built by VueJS and Element UI https://laravue.dev
https://laravue.dev
MIT License
2.21k stars 653 forks source link

Which file to write this code #129

Closed dangquanghai closed 4 years ago

dangquanghai commented 4 years ago

Hi Man, I follow your instruction https://doc.laravue.dev/vi/guide/development/work-with-resource.html to use resource but I don't know ưhich file to write this the code bellow ?

curl localhost:8000/api/categories
{
  "data": [] // Because there is no category in database
}

Thanks.

martinnaughton commented 4 years ago

in the instruction it says you need update the seeder: https://laravel.com/docs/master/seeding

If you have not used laravel before then you should learn about seeders. Check a tutorial on seeders in the link above. They go here. https://github.com/tuandm/laravue/tree/master/database/seeds

This more of basic laravel question. this should be resolved.

tuandm commented 4 years ago

@dangquanghai Sorry for this late response. It's the CURL result to verify the cartegory API, you can use postman or insomnia - they will give the same result. As @martinnaughton's comment, you have to add some categories using seeder to check.

webtamizhan commented 4 years ago

Hi @tuandm !

How can we testing the endpoint on POSTMAN using Laravel airlock(sanctum)? Because it is totally different from Bearer Token and Basic Authentication. Can you please elaborate if you have time please?

Or If you have any Pre-Request Script to test endpoint please share.

Loong1992 commented 4 years ago

Hi @webtamizhan , I successfully did by following this tutorial. Laravel Sanctum (Airlock) with Postman

Pre-Request Script is

pm.sendRequest({
    url: 'http://127.0.0.1:8000/api/sanctum/csrf-cookie',
    method: 'GET'
}, function (error, response, { cookies }) {
    if (!error) {
        pm.environment.set('xsrf-token', cookies.get('XSRF-TOKEN'))
    }
})

If you want to know more, feel free to open a new issue. The following are some references based on my project. 001 002

webtamizhan commented 4 years ago

Hi @webtamizhan , I successfully did by following this tutorial. Laravel Sanctum (Airlock) with Postman

Pre-Request Script is

pm.sendRequest({
    url: 'http://127.0.0.1:8000/api/sanctum/csrf-cookie',
    method: 'GET'
}, function (error, response, { cookies }) {
    if (!error) {
        pm.environment.set('xsrf-token', cookies.get('XSRF-TOKEN'))
    }
})

If you want to know more, feel free to open a new issue. The following are some references based on my project. 001 002

Thanks buddy, it works well!