Mapbox GL is a suite of open-source libraries for embedding customizable and responsive client-side maps in web, mobile, and desktop applications. Mapbox GL maps render at a high frame rate. The abbreviation “GL” comes from OpenGL, the industry-standard Open Graphics Library. Mapbox GL allows you to use custom styles designed in Mapbox Studio. You can also manipulate every aspect of …
Laravel Sanctum
Laravel Sanctum provides a featherweight authentication system for SPAs (single page applications), mobile applications, and simple, token based APIs. Sanctum allows each user of your application to generate multiple API tokens for their account. These tokens may be granted abilities / scopes which specify which actions the tokens are allowed to perform. How It Works …
How to return large json file on laravel?
We could have some cases which should fetch large json for DB records. On laravel, we can simple following as: response->json(User::get()….) But if the records are large, it will have a lot of ram on server. Also if there are a lot of requests, it will be more problems. So, we can solve following as: …
Laravel API Documentation Generator
Automatically generate your API documentation from your existing Laravel/Lumen/Dingo routes. PHP 7.2 and Laravel/Lumen 5.7 or higher are required. If your application does not meet these requirements, you can check out the 3.x branch for older releases. Check out the documentation at the Beyond Code homepage.
Some tips to reinforce security in Laravel
Prevent from Brute-force attack In Laravel 7, Illuminate\Foundation\Auth\ThrottlesLogins is already there in LoginController which is used to prevent brute-force attack. Route::post(‘login’, ‘Auth\LoginController@postLogin’)->middleware(“throttle: maxAttempts, decayMinutes“); Prevent from going back in browser history after login/logout After logout, users should not be able to go back to the previous page by using browser’s “back” button. We need to add …
Laravel hashid
Hashid is a Laravel package, which encode/decode id of Laravel model and get hashed/unhashed version. It is useful when we want to hide the actual id of db object so that users don’t know the real id. composer require vinkla/hashidsphp artisan vendor:publish This will create a config/hashids.php file in your app that you can modify to set …
Using LaravelCollective
This is a set of packages to help us working with HTML, Remote, Annotations and Errors in Laravel. How to install composer require laravelcollective/html Basic Usage Opening a form tag:{!! Form::open([‘url’ => ‘foo/bar’]) !!} Generating a drop-down list: {!! Form::select(‘size’, [‘L’ => ‘Large’, ‘S’ => ‘Small’]) !!} Documentation For further information, please check this documentation: https://laravelcollective.com/docs/6.0/html
Sendgrid integration to Laravel
When integrating sendgrid to laravel, you need to give username and password to laravel as env variables. Here one thing to notice is that, if username does not work, try to change it to apiKey. It will work magically.
Laravel divide migrations into separate folders and run at once.
Add following code snippet in boot method of AppServiceProvider After that we can just run `php artisan migrate` and all migrations will be run at once.
laravel-activitylog
spatie/laravel-activitylog package provides easy to use functions to log the activities of the users of your app. It can also automatically log model events. All activity will be stored in the activity_log table. Here’s a litte demo of how you can use it: activity()->log(‘Look mum, I logged something’); You can retrieve all activity using the Spatie\Activitylog\Models\Activity model. Activity::all(); Here is …