insight

insight

Member Since 2 Years Ago

Experience Points 2,180
Experience
Level
Lessons Completed 0
Lessons
Completed
Best Reply Awards 0
Best Answer
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • Chatty Cathy Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

29 Dec
3 weeks ago

insight left a reply on Creating Default Object From Empty Value

@THOMASKIM - How to Automatically create that.. in my case error on

$val = HinduMarriageRegValidator::witnessesContactDetailsValidator($request);

please advise

Thanks

Anes

05 Oct
3 months ago

insight left a reply on How To Push New Array Elements Under A Common Key ?

Friends ,

Got solution by code

    $array = [
        'Attachment' => [
            [
                'mimetype' => '.pdf',
                'date' => '22/10/2018',
                'name' => 'aes.pdf',
                'server' => 'localhost',
                'path' => 'www.kk.com',
                'chklistId' => 12
            ],

                        [
                'mimetype' => '.png',
                'date' => '22/10/2019',
                'name' => 'anes.pdf',
                'server' => 'localhost',
                'path' => 'www.kk.com',
                'chklistId' => 19

                         ]
                          
        ]
            ];
$newentry =  [
                'mimetype' => '.pdf',
                'date' => '22/10/2018',
                'name' => 'aes.pdf',
                'server' => 'localhost',
                'path' => 'www.kk.com',
                'chklistId' => 1200
            ];

array_push($array['Attachment'], $newentry);

Thanks

Anes

insight started a new conversation How To Push New Array Elements Under A Common Key ?

Dear Friends, I need a json value like below

{"Attachment":[{"mimetype":".pdf","date":"11-09-2018","name":"err-407-2013.pdf","server":"127.0.0.1","path":"http:\/\/localhost\/Uploads\/10207\/2018\/1020720180911092813203\/err-407-2013.pdf"},{"mimetype":".pdf","date":"11-09-2018","name":"err.pdf","server":"127.0.0.1","path":"http:\/\/localhost\/Uploads\/10207\/2018\/1020720180911092813203\/err.pdf"}]}

here i need to add the new entries under "Attachment" key as shown ... But I have no idea how to push the new entry under a common key "Attachment" like above...

i can create single element using the array structure code below

    $arr = [
        'Attachment' => [
            [
                'mimetype' => $mimetype,
                'date' => $todayDate,
                'name' => $fileName,
                'server' => $server,
                'path' => $url,
                'chklistId' => $checklistName
            ]
        ]
            ];
    //exit;
    $json = json_encode($arr);


but i have no idea how to push second array using comma(,) . Any body please advise a solution fast...

Thanks

Anes

04 Oct
3 months ago

insight left a reply on How To Search For A Json Value In A 'text' Type Field In Postgress ?

By making the query with string concatenation solved the issue...

Thanks dear friends...

insight left a reply on How To Search For A Json Value In A 'text' Type Field In Postgress ?

At last I got the query

select * from cr.birth_atchmnts_details where fk_birth_reg_id=6 and atchmnt_details like '%"chklistId":"5"%';

But my query produce a query without single quotes as

select * from cr.birth_atchmnts_details where fk_birth_reg_id=6 and atchmnt_details like %"chklistId":"5"%;

I need to add that single quotes around LIKE

my query is

$query = 'select * from cr.birth_atchmnts_details where fk_birth_reg_id='.$id.' and atchmnt_details like %"chklistId": "'.$checklistName.'"%';

How to modify this to add the single quotes around LIKE ...

please advise

Thanks

Anes

insight left a reply on How To Search For A Json Value In A 'text' Type Field In Postgress ?

I figure out the Right query as

select * from cr.birth_atchmnts_details where fk_birth_reg_id=6 and atchmnt_details like '%"chklistId":"5"%';

But I could not make it in php . I got syntax error

I tried

$query = 'select * from cr.birth_atchmnts_details where fk_birth_reg_id='.$id.' and atchmnt_details like '%"chklistId:""'.$checklistName.'%''"';

Please advise with what I am wrong

Thanks

Anes

03 Oct
3 months ago

insight left a reply on How To Search For A Json Value In A 'text' Type Field In Postgress ?

Unluckily it's not working @staudenmeir ...

Do you please just write what SQL query you mean for this .. I will run and check it's problem of our logic in query...

Thanks

Anes

insight left a reply on How To Search For A Json Value In A 'text' Type Field In Postgress ?

Dear @staudenmeir ,

I changed my code as

$objBirthAttachDetails = BirthAtchmntsDetails::where('fk_birth_reg_id', $id)->where('atchmnt_details', 'like', '"chklistId":\"$checklistName\"')->first();

but still same issue..

insight left a reply on How To Search For A Json Value In A 'text' Type Field In Postgress ?

It's an integer value ... like 5 or 6 ..

insight left a reply on How To Search For A Json Value In A 'text' Type Field In Postgress ?

Dear Friends,

For me the solution

->where('atchmnt_details', 'like', '"chklistId":"6"')

is not working

my code is

    public function getAtchmntsRecord($id,$checklistName) {
        $objBirthAttachDetails = BirthAtchmntsDetails::where('fk_birth_reg_id', $id)->where('atchmnt_details', 'like', '"chklistId":$checklistName')->first();
        
        if($objBirthAttachDetails == null)
            $objBirthAttachDetails = new BirthAtchmntsDetails();
        return $objBirthAttachDetails;      
    }

if there is an entry with "chklistId" exist , the code did not take that object (So condition fails...

Please note my Table field type is Text

please advise a solution except change the datatype from Text.

Waiting a fast reply

Thanks

Anes

insight left a reply on How To Search For A Json Value In A 'text' Type Field In Postgress ?

Dear @staudenmeir ,

So below code

$fileInfo = $request->all(); // all details here...
    $regId = $fileInfo['regId'];
    $fileName = $fileInfo['docFile'][0]->getClientOriginalName();
    $mimetype = strrchr($fileName, '.');
    $todayDate = date('d-m-Y');
    $server = $_SERVER['HTTP_HOST'];
    $url = url('/uploads/'.$regId).'/'.$fileName;
    $arr = [
        'Attachment' => [
            [
                'mimetype' => $mimetype,
                'date' => $todayDate,
                'name' => $fileName,
                'server' => $server,
                'path' => $url
            ]
        ]
            ];
    $json = json_encode($arr);
    var_dump($json);

what change we need to make ?

please advise

Anes

insight left a reply on How To Search For A Json Value In A 'text' Type Field In Postgress ?

Database table change is freezed. So do we have any other method to convert the text field to json in code and can make our aim successful ? Please advise

Thanks

Anes

insight started a new conversation How To Search For A Json Value In A 'text' Type Field In Postgress ?

Dear Friends,

I have a table with a json value, that field type is "text".

The data inside the field as an example is

{"Attachment":[{"mimetype":".png","date":"03-10-2018","name":"sulaimanpay.png","server":"127.0.0.1:8000","path":"http:\/\/127.0.0.1:8000\/uploads\/131\/sulaimanpay.png","chklistId":"6"}]}

The field name is "atchmnt_details" and table name is "cr.birth_atchmnts_details".

I wrote a command like below

$objBirthAttachDetails = BirthAtchmntsDetails::where('fk_birth_reg_id', $id)->whereAtchmntDetails('Attachment->chklistId', $checklistName)->first();

But it's not work as intended and return as 'null' if that two conditions data inside it...

My Laravel version is 5.5.43...

Please advise a solution

Thanks

Anes

30 Sep
3 months ago

insight left a reply on How To Create A JSON String To Store In Database Table Field?

Thanks alot dear @tykus

Your solution works for me ... My solution is

$fileInfo = $request->all(); // all details here...
    $regId = $fileInfo['regId'];
    $fileName = $fileInfo['docFile'][0]->getClientOriginalName();
    $mimetype = strrchr($fileName, '.');
    $todayDate = date('d-m-Y');
    $server = $_SERVER['HTTP_HOST'];
    $url = url('/uploads/'.$regId).'/'.$fileName;
    $arr = [
        'Attachment' => [
            [
                'mimetype' => $mimetype,
                'date' => $todayDate,
                'name' => $fileName,
                'server' => $server,
                'path' => $url
            ]
        ]
            ];
    $json = json_encode($arr);
    var_dump($json);

Thanks

Anes

insight left a reply on How To Create A JSON String To Store In Database Table Field?

I know json_encode do the purpose of creating a json from an array ...

But I need to know which structure of array create that type of json .. If you can

please mention it...

insight left a reply on How To Create A JSON String To Store In Database Table Field?

Yes, a big Advise with a sample resource .... But a plain question for a question is not much helpful...

insight started a new conversation How To Create A JSON String To Store In Database Table Field?

Dear Friends,

I need a json like below

{"Attachment":[{"mimetype":".pdf","date":"11-09-2018","name":"err-407-2013.pdf","server":"127.0.0.1","path":"http://localhost/Uploads/10207/2018/1020720180911092813203/err-407-2013.pdf"}]}

i have all values in my hand with the variables

$name = $fileInfo['docFile'][0]->getClientOriginalName();
$mimetype = strrchr($name, '.');
$date = date('d-m-Y');
$server = $_SERVER['HTTP_HOST'];
$url = "http://". $_SERVER['HTTP_HOST'].url('/uploads/'.$regId).'/'.$fileName;

please write a code for me to generate like JSON string and reply soon!!

Waiting Fast response

Thanks

Anes

27 Sep
3 months ago

insight left a reply on Validation: Only Run Exists Validation If Input Is Not Empty Array

ABove solution worked .. Thanks Friends ..

insight left a reply on Validation: Only Run Exists Validation If Input Is Not Empty Array

Dear friends,

May I can give validation rule like below

        $validator = \Validator::make($input, [
            'emailId' => 'sometimes|nullable|email',
            'mobileNo' => 'sometimes|nullable|numeric|digits:10'
             ], [
            'emailId.sometimes' => 'Please enter valid email',
            'mobileNo.sometimes' => 'Please give valid mobile number with 10 digits',
         ]);

please advise fast

Thanks Anes

07 Aug
5 months ago

insight started a new conversation How To Convert .txt File To .pdf On Upload Itself ?

Dear Friends, I am looking a code solution in Laravel to convert a .txt file (for eg: a.txt) on server to a.pdf when the process of uploading itself.

Thanks

Anes

insight left a reply on How To Convert Csv,xlsx,png,jpg,jpeg.txt Files To Pdf ?

Dear @ReneeLRoberts73 ,

I am looking a coding solution dear. Please provide an answer in that way ... Hope it's good for another type of questions that may faced in life interviews lol!!

Thanks Anes

insight left a reply on How To Convert Csv,xlsx,png,jpg,jpeg.txt Files To Pdf ?

Dear @LearnHunter , (You make my requirement opposite lol!)

I got my exact requirement using PHP FPDF method by using

require('fpdf.php');

$image = 'webcam-toy-photo3.jpg';
$withoutExt = preg_replace('/\.[^.\s]{3,4}$/', '', $image);
$pdfName = $withoutExt.".pdf";
$pdf = new FPDF();
$pdf->AddPage();
$pdf->Image($image,20,40,170);
$pdf->Output(F,$pdfName);

But my Concern now is how to convert "txt" file to "PDF". Any body please suggest a method

Thanks

Anes

insight left a reply on How To Convert Csv,xlsx,png,jpg,jpeg.txt Files To Pdf ?

Dear Friends

@NOMGUY : You told about a chrome extension , I mean a Laravel mechanism to convert an uploaded file in image or txt format to PDF . So it's not relevant for me sorry.

@knubbe82 : You told about HTML to PDF conversion. I mean a Laravel mechanism to convert an uploaded file in image or txt format to PDF by automate it on upload . There is any mechanism for it ?

@komalbhatt : You also mention about html to pdf .

any new options friends ?

Anes

06 Aug
5 months ago

insight started a new conversation How To Convert Csv,xlsx,png,jpg,jpeg.txt Files To Pdf ?

Dear Friends, As a part of a requirement I need to accept all types of files (CSV,xlsx,txt,doc,docx,png,jpg) and need to upload and save in PDF format. There is any library available in Laravel for same...

Waiting your fast reply

Thanks

Anes

01 Aug
5 months ago

insight started a new conversation How To Parse This Array On Controller To Upload The Files On The Array ?

Dear Friends,

I am using primeNG component. When i try to upload multiple files i got an array in controller as

Array
(
    [0] => Illuminate\Http\UploadedFile Object
        (
            [test:Symfony\Component\HttpFoundation\File\UploadedFile:private] => 
            [originalName:Symfony\Component\HttpFoundation\File\UploadedFile:private] => Could not connect.png
            [mimeType:Symfony\Component\HttpFoundation\File\UploadedFile:private] => image/png
            [error:Symfony\Component\HttpFoundation\File\UploadedFile:private] => 0
            [hashName:protected] => 
            [pathName:SplFileInfo:private] => /tmp/phpGXkM0W
            [fileName:SplFileInfo:private] => phpGXkM0W
        )

    [1] => Illuminate\Http\UploadedFile Object
        (
            [test:Symfony\Component\HttpFoundation\File\UploadedFile:private] => 
            [originalName:Symfony\Component\HttpFoundation\File\UploadedFile:private] => impconnection.png
            [mimeType:Symfony\Component\HttpFoundation\File\UploadedFile:private] => image/png
            [error:Symfony\Component\HttpFoundation\File\UploadedFile:private] => 0
            [hashName:protected] => 
            [pathName:SplFileInfo:private] => /tmp/phpvpqY1T
            [fileName:SplFileInfo:private] => phpvpqY1T
        )

    [2] => Illuminate\Http\UploadedFile Object
        (
            [test:Symfony\Component\HttpFoundation\File\UploadedFile:private] => 
            [originalName:Symfony\Component\HttpFoundation\File\UploadedFile:private] => Errorjuly1.png
            [mimeType:Symfony\Component\HttpFoundation\File\UploadedFile:private] => image/png
            [error:Symfony\Component\HttpFoundation\File\UploadedFile:private] => 0
            [hashName:protected] => 
            [pathName:SplFileInfo:private] => /tmp/phpuVgb3Q
            [fileName:SplFileInfo:private] => phpuVgb3Q
        )

    [3] => Illuminate\Http\UploadedFile Object
        (
            [test:Symfony\Component\HttpFoundation\File\UploadedFile:private] => 
            [originalName:Symfony\Component\HttpFoundation\File\UploadedFile:private] => Errorjuly.png
            [mimeType:Symfony\Component\HttpFoundation\File\UploadedFile:private] => image/png
            [error:Symfony\Component\HttpFoundation\File\UploadedFile:private] => 0
            [hashName:protected] => 
            [pathName:SplFileInfo:private] => /tmp/phpzS1o4N
            [fileName:SplFileInfo:private] => phpzS1o4N
        )

    [4] => Illuminate\Http\UploadedFile Object
        (
            [test:Symfony\Component\HttpFoundation\File\UploadedFile:private] => 
            [originalName:Symfony\Component\HttpFoundation\File\UploadedFile:private] => Error.png
            [mimeType:Symfony\Component\HttpFoundation\File\UploadedFile:private] => image/png
            [error:Symfony\Component\HttpFoundation\File\UploadedFile:private] => 0
            [hashName:protected] => 
            [pathName:SplFileInfo:private] => /tmp/phpcAHD5K
            [fileName:SplFileInfo:private] => phpcAHD5K
        )

)

My doubt is How I can move these files using laravel 'move' option. Any body please advise me ..

My controller function is given below

<?php

namespace App\Http\Controllers;


use Illuminate\Support\Facades\File;
use Illuminate\Support\Str;
use Carbon\Carbon;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\URL;
use Illuminate\Http\Request;
use App\Item;

class ItemController extends Controller
{
    public function store(Request $request)
    {
        $file = $request->file('myfile');
        $destinationpath = public_path('uploads');

   $file_ary = array();
   $file_count = count($request->file('myfile'));

   for ($i=0; $i<$file_count; $i++) {
            $file_ary[$i] = $request->file('myfile')[$i];
            //$file->move(
   }

   


   return "output is: ".$file_ary[0]['[originalName:Symfony\Component\HttpFoundation\File\UploadedFile:private]'];
    }
}

The last return statement give me error as

Symfony\Component\Debug\Exception\FatalThrowableError: Cannot use object of type Illuminate\Http\UploadedFile as array in file /var/www/html/work-flow/app/Http/Controllers/ItemController.php on line 49
Stack trace:
  1. Symfony\Component\Debug\Exception\FatalThrowableError-&gt;() /var/www/html/work-flow/app/Http/Controllers/ItemController.php:49

Please hellp urgently

Thanks

Anes

insight started a new conversation Usage Of PrimeNG Component Will Not Give The Files Data On The Laravel Api Function. Why?

Dear Friends,

I am using Angular 5 as Front end and Laravel 5.6 as backend (for api support for front end). I need to upload files using PrimeNG component from File upload . I added the component and it shows as fine

on fileview.component.html

<div class="card wraper" id="rte">
      <form #newNoteForm="ngForm">
      <div class="card-header">
          <div class="card-header-right" style="top: 4px;">
                <card-controls cardId="rte"></card-controls>
          </div>
      </div>
      <div class="card-block">
            <editor [(ngModel)]="fileNote" name="fileNotes"></editor>
            <p-fileUpload name="myfile[]" url="http://127.0.0.1:8000/api/items" multiple="multiple"
                maxFileSize="1000000"> <!-- 1 MB-->
                <!--<ng-template pTemplate="content"> 
                    <ul *ngIf="uploadedFiles.length">
                        <li *ngFor="let file of uploadedFiles">{{file.name}} - {{file.size}} bytes</li>
                    </ul>
                </ng-template>-->
          </p-fileUpload>
        <!-- <angular-tinymce [(ngModel)]='content'></angular-tinymce> -->
          
        <div class="wraper btns_spc text-center">
            <input class="filBtns" type="button" value="Save" (click)="updateNote(newNoteForm)" >
            <input class="filBtns" type="button" value="Edit">
            <input class="filBtns" type="button" value="Update">
        </div>
      </div>
      </form>
  </div>

It's corresponding ts file is

import { Component, OnInit, Input, EventEmitter, Output, OnDestroy } from '@angular/core';
import { Location } from '@angular/common';
import { TranslateService } from '@ngx-translate/core';
import { HttpClient, HttpResponse } from '@angular/common/http';
import {Routes, RouterModule, Router, ActivatedRoute} from "@angular/router";
import {OfficialService} from '../../shared/official.service';
import {CommonService} from '../../../../../shared/services/common.service';
@Component({
  selector: 'app-file-view',
  templateUrl: './file-view.component.html',
  styleUrls: ['./file-view.component.css']
})
export class FileViewComponent implements OnInit {

  uploadedFiles: any[] = [];

  onUpload(event) {
      //alert("event is: "+event);
      for(let file of event.files) {
          this.uploadedFiles.push(file);
      }
  }    
  //@Input() id: string;
  //@Input() maxSize: number;
  //@Output() pageChange: EventEmitter<number>;
  public scrollbarOptions = { axis: 'yx'};
  page: number = 1;
  fileNote: any;
  pdfList = [];
  p: number = 1;
  showLess: boolean = true;
  toggleButtonText: string = 'View All';
  prilimnary:any={};
  sticker:any={};
  notesdet:any={};
  attachments:any={};
  draftnote:any={};
  notes=[];
  attchmnt:any={};
  ParamFileId:any={};
  lang:string;
  noteattach:any={};
  refer:any={};
  proceedings:any={};
  fieldrpt:any={};
  res:any={};
  notesList = [];
  //displayComments: boolean = false;
  showEditor: boolean = false;
  showEditorType: string;
  NoteId:number;

  

  action = {};
  actionList ={
    "userId": 0,
    "userCode": 432678,
    "userName": "sachin tendulkar",
    "roleList": {
      "roleId": 1005,
      "roleName": "APPROVER"
    },
    "screenList": {
      "screenId": 1003,
      "screenName": "file view",
      "url": "/official/v1/filemgmt/fileview",

      "controlList": [
        {
          "controlId": 1033,
          "controlName": "APPROVE",
          "controlType": "Button"
        },
        {
          "controlId": 1006,
          "controlName": "COMMENT NOTE",
          "controlType": "Button"
        },
        {
          "controlId": 1023,
          "controlName": "REJECT",
          "controlType": "Button"
        }
      ],
  

      "dropdown": {
        "overview": [{
            "id": "0",
            "name": "Overview"
          },
          {
            "id": "1",
            "name": "Reference"
          },
          {
            "id": "2",
            "name": "Valuable"
          },
          {
            "id": "3",
            "name": "Enclosure"
          },
          {
            "id": "4",
            "name": "Attachment"
          },
          {
            "id": "5",
            "name": "Correspondence"
          }
        ],
        "activities": [{
            "id": "0",
            "name": "Activities"
          },
          {
            "id": "1",
            "name": "Drafting"
          },
          {
            "id": "2",
            "name": "Agenda Note"
          },
          {
            "id": "3",
            "name": "Linking"
          },
          {
            "id": "4",
            "name": "Arising"
          },
          {
            "id": "5",
            "name": "Parking"
          },
          {
            "id": "6",
            "name": "New Attachment"
          },
          {
            "id": "7",
            "name": "Change Custodian"
          },
          {
            "id": "8",
            "name": "Send for Remarks"
          },
          {
            "id": "9",
            "name": "Send for information"
          }
        ],
        "utilities": [{
            "id": "0",
            "name": "Utilities"
          },
          {
            "id": "1",
            "name": "Sticker"
          },
          {
            "id": "2",
            "name": "Event"
          },
          {
            "id": "3",
            "name": "Reminder"
          },
          {
            "id": "4",
            "name": "Task Planner"
          },
          {
            "id": "5",
            "name": "Movement Register"
          },
          {
            "id": "6",
            "name": "Sms"
          },
          {
            "id": "7",
            "name": "Email"
          }
        ],
        "other": [{
            "id": "0",
            "name": "Other"
          },
          {
            "id": "1",
            "name": "Reference"
          },
          {
            "id": "2",
            "name": "Valuable"
          },
          {
            "id": "3",
            "name": "Enclosure"
          },
          {
            "id": "4",
            "name": "Attachment"
          },
          {
            "id": "5",
            "name": "Correspondence"
          }
        ]
      }
    }
  };

  noteFilter: any = { note: '', user: '' };
  showSticker: boolean = false;
  constructor(private location: Location, private route: ActivatedRoute,
    private router: Router,
    private http: HttpClient,private translate:TranslateService,
    private officialService:OfficialService, private commonService: CommonService) {
      this.lang = this.translate.currentLang ? this.translate.currentLang : this.translate.getBrowserLang();
      this.route.params.subscribe(params => {       
      this.ParamFileId=params.id;      
      });     
     }


  public ngOnInit() {
      let fileDetails={
      fileId: this.ParamFileId,
      language:this.lang,
      fnName :'showFile'
    };

    if(this.commonService.isToggled()){
      this.commonService.toggleSidebar();
    }
    
    if(this.actionList.screenList.controlList.length > 0){
      for (var value of this.actionList.screenList.controlList) {
        let controlName = value.controlName.replace(/ /g, '').toLowerCase();
        this.action[controlName] = true;
      }
    }
    this.officialService.postApiServices(fileDetails).subscribe(res => {

     this.res=res;
     this.prilimnary=this.res.data.Priliminarydet[0];
     this.notesdet=this.res.data.Notes_det;
     this.notes=this.res.data.Notes_det;
     if(this.res.data.attachment_det.length>0){
     this.attchmnt=JSON.parse(this.res.data.attachment_det[0].atchmnts);
     this.noteattach=this.attchmnt.Note;
     this.proceedings=this.attchmnt.proceedings;
     this.fieldrpt=this.attchmnt.FieldReport;
     this.refer=this.attchmnt.Reference;  
    }  
     var i:number;   

for (i = 0; i < this.noteattach.length; i++) {
  if(this.noteattach[i].name!=null) { 
    this.pdfList.push( {"name": this.noteattach[i].name, "url": this.noteattach[i].path});
  }
}
for (i = 0; i < this.proceedings.length; i++) {
  if(this.proceedings[i].name!=null){
    this.pdfList.push( {"name": this.proceedings[i].name, "url": this.proceedings[i].path});
  }
}
for (i = 0; i < this.fieldrpt.length; i++) {
  if(this.fieldrpt[i].name!=null){
    this.pdfList.push( {"name": this.fieldrpt[i].name, "url": this.fieldrpt[i].path});
  }
 }
for (i = 0; i < this.refer.length; i++) {
  if(this.refer[i].name!=null){
    this.pdfList.push( {"name": this.refer[i].name, "url": this.refer[i].path});
  }
 }
    this.notesList = this.notes.slice(0,4);
     
  },
      err => {
      console.log("Error occured");
      }
      );
  }

  toggleViewAll() {
    this.showLess = !this.showLess;
    this.toggleButtonText = (this.showLess)? 'View All' : 'Back';
  }

  goBack() {
    this.location.back();
  }
/*
author      : Sreeja C
Date        : 2018-07-05
Description : code to format comments which is split to array 
              based  on concatenated string ||

*/
  public getcheck(formatData){   
    var formatedDet;
    formatedDet=formatData.replace(/[{}"]/g,'').split("||");
    formatedDet= formatedDet.filter(v=>v!='');
    console.log(formatedDet);
    return formatedDet;  
  }

  updateNote(shortNote,noteComment){    
    if (this.showEditorType == 'note'){     
      console.log(shortNote);
    }
    else{
    let fileDetails={'fileId':this.ParamFileId,'cmtForId':this.NoteId,'note':noteComment,'fnName':'saveComments'};
    this.officialService.postApiServices(fileDetails).subscribe((resp) => {
      
    });  
      console.log(noteComment);
    }    
  }

  onScrollDown(){
    console.log("scrolled!!!");
    if(this.notesList.length < this.notes.length){  
      let len = this.notesList.length;
  
      for(let i = len; i < len+4; i++){
      this.notesList.push(this.notes[i]);
      }
    }
  }

  toggleSticker() {
    this.showSticker = !this.showSticker;
  }

  notesSearch(container){
    let notesDom: any = document.querySelector('#'+container+' .key-search');
    notesDom.classList.add('open');
    let notesDomElem: any = document.querySelector('#'+container+' .key-search .form-control');
    notesDomElem.style.width = "200px";
    //console.log(dom.classList);
  }

  closeSearch(container){
    let notesDom: any = document.querySelector('#'+container+' .key-search');   
    let notesDomElem: any = document.querySelector('#'+container+' .key-search .form-control');
    notesDomElem.style.width = "0px";
    notesDom.classList.remove('open');
    //console.log(dom.classList);
  }

  showComments(elemId){
    let dom: any = document.querySelector('#note-'+elemId);
    dom.classList.toggle('open');
    //this.displayComments = !this.displayComments;
  }

  toggleEditor(editorType, noteId){
    this.showEditor = !this.showEditor;
    this.showEditorType = (editorType == 'note') ? 'note' : 'comment';
    this.NoteId=noteId;
  }

  newNote(editorType, noteId){
    this.toggleEditor(editorType, noteId);
  }

  ngOnDestroy() {
    this.commonService.toggleSidebar();
  }
}

The corresponding module added in module.ts file

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { TranslateModule } from '@ngx-translate/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { IntegratedWorkspaceComponent } from './integrated-workspace.component';
import { IntegratedWorkspaceRoutingModule } from './integrated-workspace-routing.module';
import { DataTablesModule } from 'angular-datatables';
import { FileListComponent } from './components/file-list/file-list.component';
import { FileViewComponent } from './components/file-view/file-view.component';
import { PdfViewerComponent } from 'ng2-pdf-viewer';
import { NgxPaginationModule } from 'ngx-pagination';
import { EditorModule } from '@tinymce/tinymce-angular';
import { MalihuScrollbarModule } from 'ngx-malihu-scrollbar';
import { SharedModule } from '../../../shared/shared.module';
import { InfiniteScrollModule } from "ngx-infinite-scroll";
import { OfficialService } from './shared/official.service';
//import { FroalaEditorModule, FroalaViewModule } from 'angular-froala-wysiwyg';
//import { TinyMceModule, tinymceDefaultSettings } from 'angular-tinymce';
import {TooltipModule} from "ngx-tooltip";
import { SafePipe } from '../../../shared/pipes/safe.pipe';
// Upload part
import { FileUploadModule } from 'primeng/fileupload';


@NgModule({
  imports: [
    CommonModule,
    TranslateModule,
    IntegratedWorkspaceRoutingModule,
    DataTablesModule,
    NgxPaginationModule,
    EditorModule,
    MalihuScrollbarModule.forRoot(),
    SharedModule,
    //FroalaEditorModule.forRoot(),
    //FroalaViewModule.forRoot(),
    //TinyMceModule.forRoot(tinymceDefaultSettings()),
    TooltipModule,
    FormsModule,
    ReactiveFormsModule,
    FileUploadModule,
    InfiniteScrollModule
  ],
  
  providers: [
    OfficialService
  ],
  declarations: [
    IntegratedWorkspaceComponent,
    FileListComponent,
    FileViewComponent,
    PdfViewerComponent,
    SafePipe
  ]
})
export class IntegratedWorkspaceModule { }

But in my laravel backend i did not get any added file ...

<?php

namespace App\Http\Controllers;


use Illuminate\Support\Facades\File;
use Illuminate\Support\Str;
use Carbon\Carbon;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\URL;
use Illuminate\Http\Request;
use App\Item;

class ItemController extends Controller
{
    public function store(Request $request)
    {
        /*$item = new Item([
          'name' => $request->get('name'),
          'price' => $request->get('price')
        ]);
    return $request->all(); // null value here
    }
}

Any body please advise . I am running hours on this problem . But no solution yet

Thanks

Anes

26 Jul
5 months ago

insight left a reply on How To Write A Web Service For Saving The Data From Angular 5 Form ?

Dear CJJ,

In it shows 200 OK message with "Successfully added"

my concerned function is

class ItemController extends Controller
{
    public function store(Request $request)
    {
        /*$item = new Item([
          'name' => $request->get('name'),
          'price' => $request->get('price')
        ]);
        $item->save();*/
        return response()->json('Successfully added');
    }
}


I just comment out main logic due to some error in that.

Please advise

Thanks

Anes

25 Jul
5 months ago

insight started a new conversation How To Write A Web Service For Saving The Data From Angular 5 Form ?

Dear friends,

I followed the URL : https://appdividend.com/2017/09/22/laravel-5-5-angular-4-tutorial-example-scratch/

and developed a form based on angular 5

it's app.component.ts is

import { Component, Injectable } from '@angular/core';
import { Item } from './item';
import { NgForm }   from '@angular/forms';
import { Http, Headers } from '@angular/http';
import 'rxjs/add/operator/toPromise';

@Injectable()
@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
    itemName: string = '';
    itemPrice: number;
    constructor(private _http: Http){}
        private headers = new Headers({'Content-Type': 'application/json'});
    title = 'Laravel Angular 4 App';
    /*onSubmit(form: NgForm): Promise <Item>{
        alert("dsdsd");
        console.error("test");
        return this._http.post('http://127.0.0.1:8000/api/items', JSON.stringify(form.value), {headers: this.headers})
           .toPromise()
                   .then(res => res.json().data)
                    .catch(this.handleError);
  }*/
  passvalue(form: NgForm): Promise <Item>{
  alert(this.itemName);
  var obj = {itemName: this.itemName, itemPrice: this.itemPrice };
  var myData = JSON.stringify(obj);

         
          return this._http.post('http://127.0.0.1:8000/api/items', myData, {headers: this.headers})
           .toPromise()
                   .then(res => res.json().data)
                    .catch(this.handleError);
  }

  private handleError(error: any): Promise<any> {
  console.error('An error occurred', error); // for demo purposes only
  return Promise.reject(error.message || error);
  }
}


my template is (app.component.html)

<!--The content below is only a placeholder and can be replaced.-->
<div class="container">
  <h1>
    Welcome to {{title}}!!
  </h1>
  <hr />
    <form>
      <div class="form-group">
        <label for="name">Item Name:</label>
        <input type="text" name="itemName" class="form-control" [(ngModel)]="itemName">
      </div>
      <div class="form-group">
        <label for="price">Item Price:</label>
        <input type="text" name="itemPrice" class="form-control" [(ngModel)]="itemPrice">
      </div>
      <button (click)="passvalue()" class="btn btn-primary">Add</button>
    </form>
</div>



I got error when submit button as

An error occurred 
Object { _body: error, status: 0, ok: false, statusText: "", headers: {…}, type: 3, url: null }
app.component.ts:41:2
ERROR 
Error: Uncaught (in promise): Response with status: 0  for URL: null
Stack trace:
[email protected]:///./node_modules/zone.js/dist/zone.js:814:31
[email protected]:///./node_modules/zone.js/dist/zone.js:771:17
scheduleResolveOrReject/<@webpack-internal:///./node_modules/zone.js/dist/zone.js:873:17
[email protected]:///./node_modules/zone.js/dist/zone.js:421:17
[email protected]:///./node_modules/@angular/core/esm5/core.js:4967:24
[email protected]:///./node_modules/zone.js/dist/zone.js:420:17
[email protected]:///./node_modules/zone.js/dist/zone.js:188:28
[email protected]:///./node_modules/zone.js/dist/zone.js:595:25
[email protected]:///./node_modules/zone.js/dist/zone.js:500:21
[email protected]:///./node_modules/zone.js/dist/zone.js:1540:9
[email protected]:///./node_modules/zone.js/dist/zone.js:1566:17


Any body please advise

Thanks

Anes

24 Jul
5 months ago

insight left a reply on Errors Occurred When Using 'php Artisan Migrate'

Dear Friends,

I got the solution by

sudo apt-get install php-pgsql

Apache also needs to be restarted before sites can use it:

sudo systemctl restart apache2

Thanks

Anes

27 Feb
10 months ago

insight started a new conversation Local Storage Not Working Normally . Why ?

Dear Friends, I have an application in laravel . In that it uses local storage in HTML 5. But if I give an alert all local storage values set properly and work fine . But without it it's not work. I could not run a set timeout logic here . Any body have idea how to tackle this ?

Please advise

Thanks Anes

04 Jan
1 year ago

insight started a new conversation How To Add A Querystring With A Blade Variable From Foreach ?

Dear Friends ,

Please advise how i can add this variable to href url

variable is : {{$details->stations[0]['transfer_request_id}}

Url part is : <a href="{{ action("Ulbgt\[email protected]") }}">

i mean a querystring stuff...

Thanks

03 Jan
1 year ago

insight left a reply on How To Write A Query Within Another Query ?

Hi Renoirfaria,

Your point is near to my doubt but not touch my specific need . Do you please just try to write a code

My TransferRequest table has a Primary Key Id which is a foreign key in 'Stations' model. In stations model there is a field 'requested_station' which is the 'lbid' field of 'localbody' model.

In that situation on iterating the value of model 'station' we find the corresponding filed of 'localbody' model...

please try any body

Thanks

insight left a reply on How To Write A Query Within Another Query ?

No Alamin, It's not about left join concept. My doubt is how to implement above problem . It has no significance with left join..

Thanks

insight started a new conversation How To Write A Query Within Another Query ?

Dear friends,

My problem is i have 3 tables with some relation. But I need a logic which write in the logic code below

 
 $tr_req_data = TransferRequest::with(['stations' => function ($qry) {

                                      $qry->with(['localbody' => function ($qrylocalbody) {
                                        $qrylocalbody->where("stations.requested_station","=","localbody.lbid");

                                      }]);

                                  }])->paginate(5);

But I got some exception like


"message": "SQLSTATE[42P01]: Undefined table: 7 ERROR:  missing FROM-clause entry for table \"ulbgt_stations\"\nLINE 1: ...e \"ulbgt_local_bodies\".\"lbid\" in (, , ) and \"ulbgt_sta...\n                                                             ^ (SQL: select * from \"ulbgt_local_bodies\" where \"ulbgt_local_bodies\".\"lbid\" in (1, 2, 3) and \"ulbgt_stations\".\"requested_station\" = localbody.lbid)",

Please advise how this concept can do?

Thanks

01 Jan
1 year ago

insight started a new conversation How To Join Two Tables Using Eloquent ?

Dear Friends,

I have 2 tables need to join .

  1. 'local_bodies' with structure

lbid integer NOT NULL, lbname_mal character varying(50)

  1. 'requested_stations' with structure

id integer NOT NULL DEFAULT nextval('ulbgt_requested_stations_id_seq'::regclass), requested_station integer NOT NULL, option_number smallint NOT NULL

Here these two tables need to join . One person can 'request' 3 requested stations with 'option number 1,2,3'.

I have relation model for 'local_bodies' as

         public function requestedstation()
    {
       return $this->hasMany('App\Ulbgt\LocalBody','lbid');
    }

for 'requested_stations' as

           public function localbody()
    {
      return $this->belongsTo('App\Ulbgt\LocalBody','id');
    }

I wrote query using eloquent as

           $requested_station = RequestedStation::with(['localbody' => function ($qry) {
                                                $qry->select('lbid','lbname_mal');
                                     }])->select('id','requested_station','option_number')->get();

but got wrong result for 'lbname_mal'.

Please advise ... I suspect some problem in query or relation model

Waiting fast reply

Thanks

28 Dec
1 year ago

insight left a reply on How To Save My 'filename' In Json Type Field ?

I tried like this for insertion

$criteria->attachment_path = '{filenames: [".$file_details[files][0]->name."]}';
$criteria->save();

but get exception as


Invalid text representation: 7 ERROR:  invalid input syntax for type json\nDETAIL:  Token \"filenames\" is invalid.\nCONTEXT:  JSON data, line 1: {filenames... (SQL: insert into \"request_criterias\" (\"attachment_path\", \"created_by\", \"updated_by\", \"updated_at\", \"created_at\") values ({filenames: [\".$file_details[files][0]->name.\"]}, 1, 1, 2017-12-28 17:31:07, 2017-12-28 17:31:07) returning \"id\")",
    "exception": "Illuminate\Database\QueryException",

please advise

Thanks

insight left a reply on How To Write Code In Laracast?


  my code test

insight started a new conversation How To Save My 'filename' In Json Type Field ?

Dear friends,

I created a json type field to store multiple filenames. But i have no idea how to write this line data as below:

[code] $criteria->attachment_path = '/path/to/doc'; [/code]

Please advise

Thanks

27 Dec
1 year ago

insight started a new conversation What Changes Need In UploadHandler Class In Blueimp JQuery-File-Upload ?

Dear Friends, I am trying to make use of the UploadHandler.php class as an App/Library file to make ajax upload. But I have not much idea in configuration details in constructor

you can see my doubtful lines below

public function __construct($options = null, $initialize = true, $error_messages = null) { $this->response = array(); $this->options = array( 'script_url' => $this->get_full_url().'/'.$this->basename($this->get_server_var('SCRIPT_NAME')), //'upload_dir' => dirname($this->get_server_var('SCRIPT_FILENAME')).'/files/', 'upload_dir' => Storage::path('public/docs/'), //'upload_url' => $this->get_full_url().'/files/', 'upload_url' => Storage::url('public/docs/'), 'input_stream' => 'php://input', 'user_dirs' => false, 'mkdir_mode' => 0755, 'param_name' => 'files',

please any body advise each line. My biggest doubt in get_full_url ...

please advise any body ..

Thanks

26 Dec
1 year ago

insight left a reply on Is There Any Method In Eloquent To Delete A Part Of Data Or Append A Part In Json Data Type Column?

Dear Somnath,

I don't need to just update an element. I need to append new element or delete an existing element as need . please advise that way

Thanks

insight started a new conversation Is There Any Method In Eloquent To Delete A Part Of Data Or Append A Part In Json Data Type Column?

Dear friends, I am using postgress field of json to store multiple document name . My problem is I need to delete some part or append some part of data based on Deletion/addition. Please provide a solution in laravel 5.5

Thanks

24 Dec
1 year ago

insight left a reply on How To Solve Problem In Saving Form Controller With For Loop For Multiple Value ?

Dear snapey,

got the solution. Thanks

new code is:

  {
      $input     = $request->all();
      //$criteria = new TransferRequestCriteria();
      foreach ($input as $key => $value)
      {
        $content = explode('+',$key);
        $id = @$content[1];
        if($content[0]=='criteria-select') {
          if($value!=NULL)
          {
           $criteria = new TransferRequestCriteria();
           $criteria->transfer_request_id = $request->input('transfer_request_id');
           $criteria->transfer_criteria_id = $id;
           $criteria->criteria_data = $value;
           //$criteria->attachment_path = '/path/to/doc';
           $criteria->save();
          }
        }
        if ($content[0]=='criteria-radio') {
           $default_type = \App\Ulbgt\TransferCriteria::select('default_type')->where('id',$id)->pluck("default_type");
           if($default_type[0]!=$value) {
             $criteria = new TransferRequestCriteria();
             $criteria->transfer_request_id = $request->input('transfer_request_id');
             $criteria->transfer_criteria_id = $id;
             $criteria->criteria_data = $value;
             //$criteria->attachment_path = '/path/to/doc';
             $criteria->save();
           }
        }

      }

        $data['message']     = 'saved successfully';
        return array('status' => RequestStatus::SUCCESS,$data['message']);
  }```

Thanks

insight started a new conversation How To Solve Problem In Saving Form Controller With For Loop For Multiple Value ?

Dear friends, I have a form with 21 criterias. In which some are radio button with yes/o and some with select option (eg:values Father,Mother,Wife,Husband,Son,Daughter etc..). My problem is for each criteria I need to save one entry in table . I can take all values in controller with value . But my loop only save only one value from either radio button or select box if I select multiple criteria. my controller code is [code] public function savecriteria(Request $request) { $input = $request->all(); //dd($request->input('transfer_request_id')); //dd($input); $i=1; $criteria = new TransferRequestCriteria(); foreach ($input as $key => $value) { //$i++; echo $key.":".$value;

    $content = explode('+',$key);
    $id = @$content[1];
    if($content[0]=='criteria-select') {
      if($value!=NULL)
      {
       //echo "id if select  is:".$id;
       $criteria->transfer_request_id = $request->input('transfer_request_id');
       $criteria->transfer_criteria_id = $id;
       $criteria->criteria_data = $value;
       echo "count inside select is:".$i;
       $i++;
       //$criteria->attachment_path = '/path/to/doc';
       $criteria->save();
      }
    }
    if ($content[0]=='criteria-radio') {
       $default_type = \App\Ulbgt\TransferCriteria::select('default_type')->where('id',$id)->pluck("default_type");
       if($default_type[0]!=$value) {
         //echo "id if radio  is:".$id;
         $criteria->transfer_request_id = $request->input('transfer_request_id');
         $criteria->transfer_criteria_id = $id;
         $criteria->criteria_data = $value;
         //$criteria->attachment_path = '/path/to/doc';
         echo "count inside radio is:".$i;
         $i++;
         $criteria->save();
       }
    }

  }

    $data['message']     = 'saved successfully';
    return array('status' => RequestStatus::SUCCESS,$data['message']);

} [/code]

What I am wrong with ? Please advise

Thanks

22 Dec
1 year ago

insight started a new conversation How To Navigate To Next Form In Next Tab After Saving Current Form ?

Dear friends , after saving a form in url : http://127.0.0.1:8000/transfer-request#priority to http://127.0.0.1:8000/transfer-request#complete how to tell that after save? any method to tell that tab change ? waiting a solution.

N.B I mean a method instead of

return redirect()->back()->with('message', 'Success!');

Thanks

insight left a reply on How To Change A Table Field From 'Not Null' To 'Null' Using Migration ?

Hi Christo, Thanks for your great help . But in my pc i got error as

Changing columns for table "transfer_request_criterias" requires Doctrine D BAL; install "doctrine/dbal".

but the solution point of "composer require doctrine/dbal" is blocked by my pc proxy. Any point to fix this issue now?

Thanks

insight started a new conversation How To Change A Table Field From 'Not Null' To 'Null' Using Migration ?

Dear friends, I need to change one of table field from 'Not Null' to 'Null' using migration . How it can done .. please advise

Thanks

insight left a reply on How To Take A Single Table Value Using Eloquent?

Hi friends, Got solution as $default_type = \App\Ulbgt\TransferCriteria::select('default_type')->where('id',$id)->pluck("default_type");

Problem solved

Thanks

insight started a new conversation How To Take A Single Table Value Using Eloquent?

Dear Friends, During a controller method i need a field from a table using it;s id . Any method in eloquent for same .. I try this $default_type = \App\Ulbgt\TransferCriteria::select('default_type')->where('id',$id); but get some object ... please advise.

Thanks

28 Jun
1 year ago

insight left a reply on Mininum Required PHP Version For 5.1.*

Dear Friends, I am a newbie developer in Laravel. My Godaddy account only supports php 5.3 or 5.4. I think Laravel need minimum PHP version 5.6 . Am I right ?

I got error on home page as

"Parse error: syntax error, unexpected T_CLASS, expecting T_STRING or T_VARIABLE or '$' in /home/content/87/12501387/html/swaram/index.php on line 53"

Thanks

Anes P A

31 May
1 year ago

insight left a reply on How To Reset The Password Of Localhost Installation Manually ?

Thanks ModestasV,

I run the code as suggested as

App\User::find(1)->update(['password' => Hash::make('ram')]);

which makes the wonder..