How to save password and username for git pull

How to save password and username for git pull git config credential.helper store then git pull provide user-name and password and those details will be remembered later. The credentials are stored in the disk, with the disk permissions. if you want to change password later git config credential.helper store then git pull provide new password …

Method Illuminate\Database\Query\Builder::syncWithoutDetaching or sync does not exist

error Method Illuminate\Database\Query\Builder::syncWithoutDetaching or sync does not exist {message: “Method Illuminate\Database\Query\Builder::syncWithoutDetaching does not exist.”,…} => not work for hasMany pivot table , need to change to many to many, belongsToMany {message: “Method Illuminate\Database\Query\Builder::withTimestamps does not exist.”,…} => withTimestamps() not work for hasMany pivot table

Laravel Pivot table error Undefined table or Undefined column

Pivot table error: “SQLSTATE[42P01]: Undefined table: 7 ERROR: relation “pallet_pallet_location” does not exist↵LINE 1: select “pallet_location_id” from “pallet_pallet_location” wh…↵ ^ (SQL: select “pallet_location_id” from “pallet_pallet_location” where “pallet_id” = 15)“ “SQLSTATE[42703]: Undefined column: 7 ERROR: column “pallet_location_id” does not exist↵LINE 1: select “pallet_location_id” from “pallet_locations” where “p…↵ ^ (SQL: select “pallet_location_id” from “pallet_locations” where “pallet_id” = …

ng-select: Search and select via API for Angular select form

import { NgSelectModule } from ‘@ng-select/ng-select’; add NgSelectModule to component’s @NgModule to support <ng-select> in .html template .html: <divclass=”form-group”> <labelfor=”extractee_id”>Extractee</label> <ng-select #extractee_id *ngIf=”all_extractees” [items]=”all_extractees.data” [selectOnTab]=”true” bindLabel=”name” bindValue=”id” labelForId=”extractee_id” (ngModelChange)=”selectExtractee()” placeholder=”Select Extractee” formControlName=”extractee_id”> </ng-select> </div> component.ts: getExtractees() { if ( this.all_extractees ) { returntrue; } this.palletService.getAllItems(‘/extractees?orderBy=id&sortedBy=desc’) .subscribe( result=> { this.all_extractees=result; }, error=>{ this.main_result=this.palletService.error(error); } ); } selectExtractee() …

Angular CRUD and database pagination and search in one component

ng generate module Landowner ng generate component Landowner ng generate service Landowner ng generate class Landowner add module to app.module.ts add route to xx.routes.ts add link/text to menu/nav open browser should see page works modules: import { ReactiveFormsModule } from ‘@angular/forms’; // datatable import { GenericTableModule } from ‘@angular-generic-table/core’; @NgModule({ imports: [ CommonModule, ReactiveFormsModule, GenericTableModule …

How to use bootstrap in Angular

install bootstrap first: npm install –save bootstrap add @import “~bootstrap/scss/bootstrap”; to styles.scss which included in angular.json or you can just import what you need: // Bootstrap @import “~bootstrap/scss/functions”; @import “~bootstrap/scss/variables”; @import “~bootstrap/scss/mixins”; @import “~bootstrap/scss/print”; @import “~bootstrap/scss/reboot”; @import “~bootstrap/scss/type”; @import “~bootstrap/scss/images”; //@import “~bootstrap/scss/code”; @import “~bootstrap/scss/grid”; //@import “~bootstrap/scss/tables”; //@import “~bootstrap/scss/forms”;

How to use ngIf to display different content for user not login and show login router link

<div *ngIf=”user;else not_login”> <h2>Welcome {{ user.name}}</h2> </div> <ng-template #not_login> Please <a routerLink=”/user/login” >login</a> first ! <a [routerLink]=”[‘/user/login’]”id=”login”>Login</a> </ng-template> Note, if error shows: Can’t bind to ‘routerlink’ since it isn’t a known native property You need to imports: [RouterModule] to your xx.module.ts NOT app.modules.ts if this component has it own module import { RouterModule } from …

Redirect to another url after success login via API post

Redirect to another url after success login via API post You need to pass it inside the constructor as follows, constructor(private router: Router){ } Also make sure you have imported Router as follows import { Router } from ‘@angular/router’;   this.loginService.login(formValues.username, formValues.password) .pipe( tap(data=> { this.baseHttpApi.setAccessToken(data.access_token); }) ).subscribe( result=> { this.login_msg=’Loging successful’; this.router.navigate([‘/user/profile’]); }, error=> { this.login_msg=’Loging failed, Please …

How to set all HttpClient http get/post/put/delete request using Angular need to Bearer authorization

How to set all HttpClient http get/post/put/delete request using Angular need to Bearer authorization app.module.ts: import { JwtModule } from ‘@auth0/angular-jwt’; import { HttpClientModule } from ‘@angular/common/http’; export function tokenGetter() { return localStorage.getItem(‘access_token’); } @NgModule({ bootstrap: [AppComponent], imports: [ // … HttpClientModule, JwtModule.forRoot({ config: { tokenGetter: () => { return localStorage.getItem(‘access_token’); }, authScheme: ‘Bearer ‘, …

How to upload file using Angular 6 and RESTful API

How to upload file using Angular 6 and RESTful API component: File: <input (change)=”fileChange($event)” type=”file” name=”file” formControlName=”file” placeholder=”Upload file” accept=”.txt,.png,.csv”> model: fileChange(event) { letfileList:FileList=event.target.files; if(fileList.length>0) { letfile:File=fileList[0]; this.selectedFile=file; console.warn(fileList); } } onSubmit() { constform_val=this.import_file_form.value; console.warn(form_val); if (form_val.file&&form_val.note) { letformData=newFormData(); formData.append(“note”, form_val.note); formData.append(“import_type”, form_val.import_type); formData.append(“file”, this.selectedFile); this.ImportFileService.upload(formData) .subscribe(api_data => { console.log(‘Return Form API:’); console.log(api_data); } ); …