cobonto

Experience

2,780

0 Best Reply Awards

  • Member Since 11 Months Ago
  • 27 Lessons Completed
  • 0 Favorites

14th September, 2017

cobonto left a reply on How To Secure Register Endpoint Api For First Party Mobile App ? • 2 months ago

If i guess what you mean i explain it for you.

  1. api like website is public and everyone can access it .But if you want to your android or ios app just use it and public access is restricted you put SECURE_KEY=yourkey in .env and add in your config/app.php or config/api.php whatever you like and in your ios or android app with every request send SECURE_KEY value to the api and create middleware like SecureApi.php in handle
    class SecureApi
{
    public function handle(Request $request, \Closure $next){
        return $next($request);
          if($request->header('secure-key') !=config('api.secure_key')){
           throw  new BadRequestHttpException('bad_http_exceptions');
       }
       return $next($request);
    }
}

with this code in your middlleware if someone dont have secure api can not access to api for log in user you have this and auth access token Hope its help

6th September, 2017

cobonto left a reply on How To Secure Register Endpoint Api For First Party Mobile App ? • 2 months ago

If you don't have user credential. So you work with sample data?

I think you should explain more about your api

But when i have this problem to prevent others use api except our applications

in android or ios i create something like

secure-api and create SecureApi middleware

So other people cant access to api anymore

Hope this answer solve your problem

cobonto left a reply on How Do You Use Eloquent Relationships When Storing Data In A Database? • 2 months ago

laravel 5.4 like 5.x has same way to insert . I think its best way that you try to engage with that and if you have specific problem post here. Because inserting its huge discuss like Insert in pivot table insert in one to one relationshiop insert in one to many and ....

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.