mysql laravel Cannot add foreign key constraint

Some time if the charset and engine type of parent & child tables may be difference.
The change the char set ref : previous post https://journeyontux.wordpress.com/2018/05/23/1267-illegal-mix-of-collations-utf8mb4_unicode_ciimplicit-and-utf8mb4_general_ciimplicit-for-operation/

To change the engine type of a table

ALTER TABLE my_table ENGINE = InnoDB

Advertisements

#1267 – Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8mb4_general_ci,IMPLICIT) for operation ‘=’

This error is because of different charset for tables in the database. To fix this, make the database and tables are same charset.

To change your database
ALTER DATABASE databasename CHARACTER SET utf8 COLLATE utf8_general_ci;

Then to change your table
ALTER TABLE tablename CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;

All Set Good To Go 🙂

Take Photos with Ionic

Install Plugin first 
$ ionic cordova plugin add cordova-plugin-camera $ npm install --save @ionic-native/camera

include in app module

src\app\app.module.ts

import { Camera } from ‘@ionic-native/camera’;

providers: [

Camera
]

in html

<button ion-button (click)="capture()">Lets take a picture!</button> <img [src]="captureDataUrl" *ngIf="captureDataUrl"/>

in ts create capture function

import { Camera, CameraOptions } from ‘@ionic-native/camera’;
……..

captureDataUrl: string;

constructor(private camera: Camera) { }

const options: CameraOptions = {
quality: 100,
destinationType: this.camera.DestinationType.DATA_URL,
encodingType: this.camera.EncodingType.JPEG,
mediaType: this.camera.MediaType.PICTURE
}

this.camera.getPicture(options).then((imageData) => {
// imageData is either a base64 encoded string or a file URI
// If it’s base64:
captureDataUrl = ‘data:image/jpeg;base64,’ + imageData;
}, (err) => {
// Handle error
});

That’s it, run the app in android device, wont work on browser as it require camera.