If you’re creating an application that supports international purchases, you would definitely want to show the prices in the user’s localised currency and formatting (since different countries have different formats). Doing this cleanly and efficiently would be a challenge. So we will be using 2 packages by Daniel Stainback that will make this easy and efficient.

Part A — Installation and Configuration

Install the packages

We will install 2 packages. The torann/currency package for currency conversion and formatting, and the torann/geoip package for detecting the local currency of the user.

composer require torann/currency
composer require torann/geoip

Let us publish the config and migration files so that…


The latest versions of Laravel and Cashier have brought many changes and made it significantly easier to build features in our web applications. In this tutorial, we will build a simple subscription system using Stripe.

1. Install the Cashier package

Run the following command.

composer require laravel/cashier

This will install migrations for adding required columns to the users table, and also create a subscriptions table. So let us run the migrations.

php artisan migrate

Optionally, you can publish the migration files to your project database directory along with other migrations.

php artisan vendor:publish --tag="cashier-migrations"

We will also require stripe-php package later for retrieving our subsriptions…


Assuming you have an existing Laravel project, we will create a database for Books and we will write endpoints for its CRUD operations, which means Create, Read, Update and Delete. We will create the following endpoints:

GET /api/books : to return a list of all the books

GET /api/books/{id} : to return details of a particular book by ID

POST /api/books : to create a new book

PUT /api/books/{id} : to update details of a book by iD

DELETE /api/books/{id} : to delete a book by ID

So let’s get started.

Note: If you don’t have an existing Laravel project…


Laravel makes API authentication a breeze using Laravel Passport, which provides a full OAuth2 server implementation for your Laravel application in a matter of minutes.

If you are new to Laravel, I suggest you go through this article first to learn how to set up and create a new project.

Once you have a project, you can continue below.

Step 1

Install Passport

In your laravel project, run the command

composer require laravel/passport

and then run migrate command to create all the necessary tables.

php artisan migrate

Finally, install it

php artisan passport:install

This command will create the encryption keys needed to…


This tutorial is concise and assumes that you already know how to add constraints, connect outlets, and create delegates.

Leave a comment below if you are a beginner and need assistance with these!

Design

First let us design the alert view.

Drag a ViewController on to your storyboard.

Add a view, add necessary constraints, header labels and the most important part — a UIPickerView. Also add OK and Cancel buttons at the bottom. Here’s how my view looks after design.


Objective

In this tutorial, we shall have a project named ‘mystore’, which can have 2 kinds of users, either ‘admin’ or ‘seller’. They will have separate dashboards with separate features and functionalities. When a user logs in to our website, they will be redirected to a dashboard according to their role. Also, the routes should be protected, meaning, the logged in user should not be able to access the dashboard or any of the inside pages of the other role, even if they type the URL in the browser. So let us begin.

If you are new to Laravel, I recommend…


Showing the AppBar as soon as you begin scrolling upward

The SliverAppBar provided by Flutter, supports a floating app bar that hides upon scrolling down. But there’s one downside about it, it reappears only when the user scrolls back up all way to the top of the scroll view. This can be undesirable if the scroll content happens to be larger. For example in the Medium app, the app bar shows up as soon as you start scrolling upward, no matter where you are. This is what we want.


Apple’s MapKit makes it very easy to get directions from one coordinate to another. Let us see how to use this to show a route on an MKMapView.

First, make the ViewController conform to the MKMapViewDelegate protocol.

and make sure the outlet of the map view is attached and the delegate is set.

mapView.delegate = self

Now write this method for showing the route. This method performs the following actions

  1. Takes 2 coordinates as parameters
  2. Fetches direction between the 2 points
  3. Displays the fetched route on the map
  4. Zooms the map to the route area.
func showRouteOnMap(pickupCoordinate: CLLocationCoordinate2D, destinationCoordinate: CLLocationCoordinate2D)…


This tutorial shows, in a Swift app, how we can use MapKit’s free direction service MKDirections, to get a route between two coordinates and show the resulting route on a Google Map, GMSMapView.

First, get this file, and save it within your project as Polyline.swift. This will be used to create Polyline from coordinates:

Second, use the two coordinates and pin markers on the points.

import UIKit
import GoogleMaps
import MapKit
func setMapMarkersRoute(vLoc: CLLocationCoordinate2D, toLoc: CLLocationCoordinate2D) {

//add the markers for the 2 locations
let markerTo = GMSMarker.init(position: toLoc)
markerTo.map = mapView…


Image Picker is a common component we often need for user-profiles and other stuff. We will be using this plugin by Flutter developers.

Step 1 — Add the dependency to your pubspec.yaml file.

image_picker: ^0.6.6+5

Step 2 — Configure native platforms

Next, we need to configure native settings. For the Android platform, nothing is needed. For iOS, open Info.plist file found under ios/Runner folder and add the following keys.

<key>NSPhotoLibraryUsageDescription</key>
<string>Allow access to photo library</string>

<key>NSCameraUsageDescription</key>
<string>Allow access to camera to capture photos</string>

<key>NSMicrophoneUsageDescription</key>
<string>Allow access to microphone</string>

Step 3 — Image Picker function

In our screen’s StatefulWidget’s State class, declare a File variable to hold the image picked by the user.

File _image;

Now write two functions for picking image via…

Zeba Rahman

App Developer | fabcoding.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store