nafeeur10

nafeeur10

Member Since 2 Years Ago

Experience Points
11,820
Total
Experience

3,180 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
28
Lessons
Completed
Best Reply Awards
2
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

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

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

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

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    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 Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

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

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

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

Level 3
11,820 XP
Jun
01
18 hours ago
Activity icon

Replied to Code Works In Jsfiddle But Not In Localhost Or Server: Laravel 6

@deanvangreunen,

Are you working with Dropdown? Or just problem with DataTable??

Activity icon

Started a new Conversation Children But Not Sub Menu In Vue Js

-------------
   Menu
-------------

In sidebar of Admin Panel, there will be a Menu. When I will click on this Menu a page will come. That's fine.

But in this page I will also use some vue-router but they are not sub menu of that. I am trying with the below code, but not working!!!

{
    path: '/setup',
    component: Layout,
    meta: { title: 'Menu', icon: 'guide', noCache: true },
    component: () => import('@/views/custom/engage/index'),
    name: 'EngageDashboard',
    children: [
      {
        path: 'setup/domain',
        component: () => import('@/views/custom/engage/setup'),
        name: 'EngageDomain'
      }
    ]
  }

Here, while I will click on Menu' then index` page will come. In index page, there will be a button, after clicking that button setup page will come.

But now Menu is not showing

May
31
1 day ago
Activity icon

Replied to How To Protect URL In Laravel

@snapey,

Now I can understand what is my problem to think!!!!

Thank you.

Activity icon

Replied to How To Protect URL In Laravel

@michaloravec,

Can you please answer with my code??

What is the problem in my code??

Activity icon

Replied to How To Protect URL In Laravel

@michaloravec,

Okay. But Can't I do that with Middleware??

Activity icon

Started a new Conversation How To Protect URL In Laravel

I can't protect my url from one auth user to another. For Example:

www.accounting.com/user/edit/1
www.accounting.com/user/edit/2

User 1 and User 2 both are authenticated user. But hitting url they can access both!!!

I have tried with Middleware. But now page is not coming!!!!

What is the problem??

Middleware Class:

public function handle($request, Closure $next)    
{        
     if ($request->id != auth()->user()->id) {           
     return redirect('home')
            ->with('error','You are not the owner of this Page');
     return $next($request);    
}        

web.php

Route::group(['middleware' => ['auth', 'checkUser'], 'prefix' => 'admin', 'as' => 'admin.'], function () {
-----
});

If I remove 'checkUser' then page is refreshing!!!

May
20
1 week ago
Activity icon

Replied to Store And Update Button Will Work One After Another: Laravel 6

@tomasosho,

Same function for Store and Update

public function saveCost(Request $request)
{
        Incoming::where('id', $request->id)
                ->update([
                    'incoming_invoice_costs' => $request->cost,
                    'vat'                    => $request->vat
                    ]);
        return json_decode('success', 'Successfully Added Cost and VAT');
}
Activity icon

Started a new Conversation Store And Update Button Will Work One After Another: Laravel 6

I have a form like this:

----------------------------------------------------
Cost             VAT            Store-Button
----------------------------------------------------

While a user will input Cost and VAT and then click on Store-Button, then with ajax, data will sent to Database. This is working fine.

While Ajax is successful, then Store-Button will be Update Cost & VAT. If user will click on Update Cost & VAT then the form will come for update.

My problem is:

After ajax success, I can change the button with the following code:

$('form').on('submit', function(e) {
    e.preventDefault();


$.ajax({
        type: "POST",
        headers: {'x-csrf-token': _token},
        url: "{{ route('costsaving') }}",
        data: { 
            id: thenum, 
            cost: valueOfInput,
            vat: valueOfVatSelectOpt
        },
        success: function(result) {
            $("#addNewUpdateButton"+thenum).append("<button class='btn btn-info btn-xs cost-update-button' id='costandvatUpdateBtn"+thenum+"'>Update Cost & VAT</button>");
    }
)};

}

This button should submit the form. But form is not coming!! If I add this button in real, then the form is coming.

Real code, not in jquery:

 <button class="btn btn-info btn-xs cost-update-button" id="costandvatUpdateBtn{{ $incoming->id }}">Update Cost & VAT</button>

Click event of that button:

$('.cost-update-button').on('click', function(e) {
    let idOfUpdateRow = (this.id).replace(/\D/g, "");
    update = true;
});

Form:

<form method="POST">

<input type="text" id="cost{{ $incoming->id }}" data-id="{{ $incoming->id }}" name="incoming[{{ $incoming->id }}]" class="form-control shadow-none">

</form>
May
13
2 weeks ago
Activity icon

Replied to How To Submit Dynamic Form In Laravel With Ajax

@michaloravec,

$(this).serializeArray()[0]['name'];

with this I am getting incoming[46]

How will I extract the id from this string?!!

Activity icon

Replied to How To Submit Dynamic Form In Laravel With Ajax

@michaloravec,

Thank you for your answer. Can you tell me how will I get ID of my input field?

Activity icon

Replied to How To Submit Dynamic Form In Laravel With Ajax

@michaloravec,

Same result. Nothing is giving in console.

Activity icon

Started a new Conversation How To Submit Dynamic Form In Laravel With Ajax

I have a DataTable where I am using a Form to Submit Data.

@foreach($incomings as $key => $incoming)
<tr>
<td>
   <form method="POST" class="form-group">
        <div class="flex-row d-flex">
             <input type="text" id="{{ $incoming->id }}" class="form-control">
             <button class="btn btn-success cost-submit-button" type="submit">Store</button>
        </div>
    </form>
</td>
</tr>
@endforeach

So, you can understand it's dynamic. How will I get this dynamic form?

Trying this:

$(".cost-submit-button").click(function(e) {
    e.preventDefault();
    console.log($(this).serialize());
});

This is not giving any data!!! May I am wrong!

May
06
3 weeks ago
Activity icon

Started a new Conversation The Response Content Must Be A String Or Object Implementing __toString(), "object" Given.

Trying to get Last Sunday of Last Week

But giving me this error: The Response content must be a string or object implementing __toString(), "object" given.

Code:

$lastSunday = date_create(date('Y-m-d', strtotime('last sunday of last week')));

What does this means?

Apr
29
1 month ago
Activity icon

Replied to How To Put GET Requested Data In Datatable

Have you any example of that?

Activity icon

Replied to How To Put GET Requested Data In Datatable

@gokulkhatiwada,,

Thank you for your Reply. I am using the AJAX request in the Button Action.

Then what will be the changes?

buttons: [
 {
      text: 'This Week',
      action: function ( e, dt, node, config ) {
      $.ajax({
          url: "{{ route('finance-this-week') }}",
          method: 'GET',
          dataType: "json",
          success: function(data) {
                columns: [
                    { 'data': 'id' },
                    { 'data': 'invoiceNumber' },
                    { 'data': 'customerId' },
                    { 'data': 'actions' }
                ]
            }, error: function(data) {
                    console.log(data);
            }
       })
  }
 }
]
Apr
28
1 month ago
Activity icon

Started a new Conversation How To Put GET Requested Data In Datatable

I am using Data Table to show Invoice Details.

In my DataTable I used Collection Filter.

https://datatables.net/extensions/buttons/examples/initialisation/collections-sub.html

Here I want to make an AJAX Request which will give me Collection of Invoice. I have to put these on dataTable.

Data will be like that:

[
{
    InvoiceNumber: 343434,
    companyName: Aspile Inc.
},
{
    InvoiceNumber: 343434,
    companyName: Google Inc.
}
]
$.ajax({
     url: "{{ route('finance') }}",
      method: 'GET',
      success: function(data) {
               ?????
      }, error: function(data) {
               console.log(data);
      }
})

DataTable is as usual........ How is this possible?

Apr
26
1 month ago
Activity icon

Replied to Repost: Fatal Error: Uncaught Error: Class 'todo\views\DataBase' Not Found

Fatal error: Uncaught Error: Class 'todo\views\DataBase' not found in E:\xampp\htdocs\mytodo\src\views\todos.php:5 Stack trace: #0 {main} thrown in E:\xampp\htdocs\mytodo\src\views\todos.php on line 5

Activity icon

Replied to Repost: Fatal Error: Uncaught Error: Class 'todo\views\DataBase' Not Found

@bobbybouwmann,

Thank you. I will obviously see these two series. But error is not going!!!

I am not in index.php file.

Trying to access this class with this url: http://localhost/mytodo/src/views/todos.php

Activity icon

Started a new Conversation Repost: Fatal Error: Uncaught Error: Class 'todo\views\DataBase' Not Found

I am using composer to autoload my classes.

My Folder structure:

mytodo
     - src
        -app
            IDb.php
        -views
            db.php
            todos.php
     - web
         index.php
     -composer.json

Trying to inherit Database class from todos.php __constructor(). But giving this error!!!

todos.php

<?php
namespace todo\views;
use todo\app\IDb;

class Todo extends DataBase implements IDb{

    public function __construct() 
    {
         $newdb = new DataBase();
         $connection = $newdb->connect();
    }
}

composer.json

{
    "name": "todo/website",
    "description": "This is a TODO App",
    "minimum-stability": "stable",
    "autoload": {
        "psr-4": {
            "todo\": "src/"
        }
    },
    "require": {
        "php": ">=7.2.0"
    }
}

db.php

<?php
namespace todo\views;
use todo\app\IDb;

abstract class DataBase implements IDb{

    private $user;
    private $host;
    private $pass;
    private $db;
    protected $connection;

    public function __construct()
    {
        $this->user = "root";
        $this->host = "localhost";
        $this->pass = "";
        $this->db = "db_todos";
    }

    public function connect()
    {
        $connection = mysqli_connect($this->host, $this->user, $this->pass, $this->db);
        return $connection;
    }
}
?>

DB Interface:

<?php
namespace todo\app;

interface IDb {
    public function connect() : string;
}

Can't figure out the problem. Please help me in advance.

Activity icon

Started a new Conversation Fatal Error: Uncaught Error: Class 'todo\views\DataBase' Not Found

I want to extends Database Connection Class but giving me this error!

Interface to IDB:

<?php
namespace todo\app;

interface IDb {
    public function connect() : string;
}

Implementation of this interface

db.php file:

<?php
namespace todo\views;
use todo\app\IDb;

abstract class DataBase implements IDb{
    
    private $user;
    private $host;
    private $pass;
    private $db;
    protected $connection;

    public function __construct()
    {
        $this->user = "root";
        $this->host = "localhost";
        $this->pass = "";
        $this->db = "db_todos";
    }

    public function connect()
    {
        $connection = mysqli_connect($this->host, $this->user, $this->pass, $this->db);
        return $connection;
    }
}
?>

todos.php

This todos will extends Database class and connection string will be accessible by $connection which is protected.

<?php
namespace todo\views;
use todo\app\IDb;

class Todo extends DataBase implements IDb{

    public function __construct() 
    {
        $newdb = new DataBase();
        $connection = $newdb->connect();
    }
}

How will I do this?

Activity icon

Started a new Conversation What Is The Json_encode Data Type In Interface PHP

I am creating my personal Todo App using OOP PHP and Composer Autoload.

I am using Interface to Declare the Classes.

In some of my classes has return type json_encode()

LIKE THIS:

<?php
include ("../db.php");

class ActiveTodo {

    private $connection_string ;

    public function getActiveList() {
        $sql = "SELECT * FROM todo WHERE todo_status = 0";
        $result = mysqli_query($this->connection_string, $sql);
        return $result ? $result->fetch_all(MYSQLI_ASSOC) : [];
    }
}

$todo = new ActiveTodo;
echo json_encode($todo->getActiveList());

?>

I have declared Interface like this.

<?php
namespace todo\app;

interface ILastid extends IDb{
    public function fetchLastId();
}

Now what will be the return type for json_encode()? If we have int return then we gave:

public function getId() : int;

Apr
25
1 month ago
Activity icon

Started a new Conversation Update DB Value Is Not Working, PHP

Update is not working!!!

<?php
include ("../db.php");

class Update {

    private $connection_string ;

    public function __construct() {
        $db = new DataBase();
        $this->connection_string = $db->connect();
    }

    public function Update() {
        if(isset($_POST['id'])) 
        {
            $id = $_POST['id'];
            $title = $_POST['title'];
            $edit = $_POST['edit'];
            $sql = "UPDATE todo SET todo_title = ".$title.", edit = ".$edit. " WHERE id = " .$id;
            $result = mysqli_query($this->connection_string, $sql);
        }
       
    }
}

$todo = new Update;
$todo->Update();

?>

What is the problem? Query is correct or not?

Activity icon

Started a new Conversation Why Update Is Not Working? PHP, Vue

Form to submit:

<form class="w-100" v-if="todo.edit==1" @submit.stop.prevent="updateTodo(todo.id, todo.todo_title, todo.edit)">
       <input type="text" class="form-control w-100" v-model="todo.todo_title">
</form>

Update Function:

updateTodo(id, title, edit) 
{
            const self = this

            let formData = new FormData();
            formData.append('id', id);
            formData.append('title', title);
            formData.append('edit', edit);

            axios({
                method: 'POST',
                url: 'api/update.php',
                data: formData
            }).then(function(res){
                self.todoList.find(todo => {
                    if(todo.id === id) {
                        todo.edit = 0,
                        todo.todo_title = title
                    }
                });
            }).catch(function(err) {
                console.log(err)
            })
 }

api/update.php:

<?php
include ("../db.php");

class Update {

    private $connection_string ;

    public function __construct() {
        $db = new DataBase();
        $this->connection_string = $db->connect();
    }

    public function Edit() {
        if(isset($_POST['edit'])) 
        {
            echo "UES";
        }
       
    }
}

$todo = new Update;
$todo->Edit();

?>

It is getting Edit() function, but It is not entering if(isset($_POST['edit'])) {} this block!!! But why? Other function is working. FormData values are valid.

Apr
24
1 month ago
Activity icon

Replied to How To Get The Last ID During Insert New Record: PHP, Vue?

@wingly,

Yes. but not working outside that.

Activity icon

Replied to How To Get The Last ID During Insert New Record: PHP, Vue?

Inside the

axios.get('api/lastid.php').then(function(res){
     this.lastId = ( res.data[0].id + 1)
}).catch(function(res) {
     console.log(res);
})

It is getting the value. But in outside it is not working!!!!!!

Activity icon

Started a new Conversation How To Get The Last ID During Insert New Record: PHP, Vue?

Insert New Record to Database. Insertion is not problem. Main problem is to get Last ID.

createTodo(e) {

/* 
    Get the last ID of TODO. 
    New insertion will get new ID with +1
*/

axios.get('api/lastid.php').then(function(res){
     this.lastId = ( res.data[0].id + 1)
}).catch(function(res) {
     console.log(res);
})

// Form to submit Data

let formData = new FormData();
formData.append('todo_title', this.todo)
formData.append('real_id', this.lastId)

console.log(this.lastId);

axios({
  method: 'POST',
  url: 'api/todos.php',
  data: formData
}).then(function(res){
  console.log(res.data)
}).catch(function(res){
  console.log(res)
});

}

Data:

data() {
        return {
            todo: null,
            todoList: [],
            lastId: null
        }
    },

lastID is null. But lastid.php is giving me correct result.

What is the problem?

Activity icon

Started a new Conversation How To Get Last Id Of A Table In PHP, Vuejs

Call from VUE:

axios({
    method: 'GET',
    url: 'api/lastid.php'
}).then(function(res){
    console.log("Last ID: " + res.data)
}).catch(function(res) {
    console.log(res);
})

api/lastid.php

<?php
include ("../db.php");

class LastID {

    private $connection_string ;

    public function __construct() {
        $db = new DataBase();
        $this->connection_string = $db->connect();
    }

    public function fetchLastId() {
        $sql = "SELECT id FROM todo ORDER BY id DESC LIMIT 1";
        $result = mysqli_query($this->connection_string, $sql);
        return $result ? $result->fetch_all(MYSQLI_ASSOC) : [];
    }
}

$todo = new LastID;
$todo->fetchLastId();

?>

But no result is showing in console.log("Last ID: " + res.data)

What is my mistake?!!

Apr
22
1 month ago
Activity icon

Replied to Load Data After Insert In Db: Vuejs

How will I hook it?

Activity icon

Started a new Conversation Load Data After Insert In Db: Vuejs

I have two functions.

  1. Submit data to DB after Press Enter.
  2. Fetch data from DB.

Functions are working fine. Data are fetching from DB. But need to refresh the page.

I don't want to refresh the page. After Enter new value, The value will automatically added to the result without any refresh.

How is this possible?

Form to Submit data:

<form class="w-100" @submit="createTodo">
       <div class="form-group w-100">
             <input type="text" class="form-control w-100">
       </div>
</form>

This is the List of all items:

<ul>
     <li v-for="todo in todoList">
          {{ todo.todo_title }}
     </li>
</ul>

Create and Get the List Methods:

createTodo(e) {

            let formData = new FormData();
            formData.append('todo_title', this.todo)

            axios({
                method: 'POST',
                url: 'api/todos.php',
                data: formData
            }).then(function(res){
                this.$forceUpdate()
                console.log(res)
            }).catch(function(res){
                console.log(res)
            });

            //console.log(this.todo);
            this.todo = null
            e.preventDefault();
        },

        getTodoList() {
            console.log("Getting todo list....");

            axios.get('api/todos.php').then(function(res){
                app.todoList = res.data
                console.log(res.data)
            }).catch(function(res){
                console.log(res);
            });
        }

What will be the best approach for this solution?

Activity icon

Replied to Trying To Get Data But It's Amazing!!

@ucha19871,,

console.log(res.data); is nothing.

@maverickchan,

How??

Apr
20
1 month ago
Activity icon

Started a new Conversation Trying To Get Data But It's Amazing!!

Method to get Data:

getTodoList() {
    console.log("Getting todo list....");
    axios({
        method: 'GET',
        url: 'api/todos.php'
    }).then(function(res){
         console.log(res);
    }).catch(function(res){
         console.log(res);
    });
}

It is giving me this Result:

https://ibb.co/tJ1Xb0L

api.todos.php

<?php
    class Todo {

        private $connection_string ;

        public function __construct() {
            include "../db.php";
            $db = new DataBase;
            $this->connection_string = $db->connect();

            if(!isset($this->connection_string)) {
                die("Connection Failed". ' '. mysqli_error($this->connection_string));
            }
        }

        public function fetchTodo() {
            $sql = "SELECT * FROM todo ";
            $result = mysqli_query($this->connection_string, $sql);

            if (!$result) {
                http_response_code(404);
                die(mysqli_error($this->connection_string));
            }
        }
    }

    $todo = new Todo;
    $todo->fetchTodo();
?>

What is the problem, I can't understand!!

Apr
19
1 month ago
Activity icon

Replied to How To Declare A Variable To Use For All Function In Laravel 6?

@tykus,

Actually I can do it in other ways. But just want to see how to use variables of a class from functions this in Laravel. :-)

Activity icon

Started a new Conversation How To Declare A Variable To Use For All Function In Laravel 6?

I want to declare a variable $id

This id will be the Auth::id()

Now what will be the apporach?

private static $id;

public function __construct()
{
   $this->id = Auth::id();
}

But this id is not accessible from function Query.

Invoice::where([
     ['userID', '=', $id],
     ['created_at', '=', $todayDate]
])->get();

Giving error in this line: ['userID', '=', $id],

Undefined Variable $id.

Apr
09
1 month ago
Activity icon

Started a new Conversation Route [destroy.expiredInvoice] Not Defined.

Web.php

Route::delete('/invoice/delete/{invoice}', '[email protected]')->name('destroy.expiredInvoice');

Blade.php

<form action="{{ route('destroy.expiredInvoice', $outgoing->invoiceNumber) }}" method="POST" onsubmit="return confirm('Are you sure?');" style="display: inline-block;">
        <input type="hidden" name="_method" value="DELETE">
        <input type="hidden" name="_token" value="{{ csrf_token() }}">
        <input type="submit" class="btn btn-xs btn-danger" value="{{ trans('global.expired_button') }}">
</form>

Controller:

public function destroy($invoiceNumber)
{
     dd($invoiceNumber);
}

What is the problem I can't figure out!!!!

Apr
05
1 month ago
Activity icon

Started a new Conversation Undefined Index: Name In Laravel 7

All of my json data are coming. Just problem with "name"

What can be the problem?

JSON DATA:

{
          "latitudeE7" : 202986400,
          "longitudeE7" : 858231540,
          "placeId" : "ChIJ8WPm-MMJGToRQ4jSqi6vofA",
          "name" : "adidas",
          "locationConfidence" : 0.36950353
}

Code:

$main_person_information = new AffectedMainPerson;
$main_person_information->latitudeE7 = $location["latitudeE7"];
$main_person_information->longitudeE7 = $location["longitudeE7"];
$main_person_information->placeID = $location["placeId"];
$main_person_information->address = $location["address"];
if(isset($location["name"]))
{$main_person_information->nameOfPlace = $location['name'];}
else
{$main_person_information->nameOfPlace = 'Unknown';}

Every time Unkoown!!! But others data are coming to database. Only name!!!!!!

Activity icon

Started a new Conversation How To Retrieve Data From Json In Laravel Controller?

{
  "timelineObjects" : [ {
    "activitySegment" : {
      "startLocation" : {
        "latitudeE7" : 202687025,
        "longitudeE7" : 858477768,
        "sourceInfo" : {
          "deviceTag" : 583609661
        }
      },
      "endLocation" : {
        "latitudeE7" : 202983451,
        "longitudeE7" : 858231388,
        "sourceInfo" : {
          "deviceTag" : 583609661
        }
      },
      "duration" : {
        "startTimestampMs" : "1530425608000",
        "endTimestampMs" : "1530432579011"
      },
      "distance" : 26898,
      "activityType" : "IN_PASSENGER_VEHICLE",
      "confidence" : "HIGH",
      "activities" : [ {
        "activityType" : "IN_PASSENGER_VEHICLE",
        "probability" : 95.3502898004571
      }, {
        "activityType" : "MOTORCYCLING",
        "probability" : 2.6276337657383504
      }, {
        "activityType" : "WALKING",
        "probability" : 1.5061634477236965
      } ],
      "waypointPath" : {
        "waypoints" : [ {
          "latE7" : 202686958,
          "lngE7" : 858477706
        }, {
          "latE7" : 202442302,
          "lngE7" : 857703323
        }, {
          "latE7" : 202370185,
          "lngE7" : 857492980
        }, {
          "latE7" : 202420043,
          "lngE7" : 857600021
        }, {
          "latE7" : 202986183,
          "lngE7" : 858235855
        } ]
      },
      "simplifiedRawPath" : {
        "points" : [ {
          "latE7" : 202366846,
          "lngE7" : 857490683,
          "timestampMs" : "1530427247025",
          "accuracyMeters" : 77
        } ]
      },
      "editConfirmationStatus" : "NOT_CONFIRMED"
    }
  }

There are a lot of data like this. I just want some fields like latitudeE7 , longitudeE7, timestampMs etc.

I can handle data like this

$data = json_decode($json_data, true);
$location = ($data["timelineObjects"][1]["placeVisit"]["location"]);
$main_person_information->latitudeE7 = $location["latitudeE7"];

But I don't want to do this.

I will just split all data and $data["latitudeE7"] will give me all latitudeE7 data.

Apr
04
1 month ago
Activity icon

Started a new Conversation How To Upload Json File And Extract In Laravel 7

Hello,

I want to upload a json file and Extract it in Controller and keep the data in Database. What will be the approach?

File Upload Controller:

public function fileUploadPost(Request $request)
    {
 
        dd($request);

        $request->validate([
            'file' => 'required|mimes:pdf,xlx,csv,json|max:2048',
        ]);
  
        $fileName = time().'.'.$request->file->extension();  
   
        $request->file->move(public_path('uploads'), $fileName);
   
        return back()
            ->with('success','You have successfully upload file.')
            ->with('file',$fileName);
   
    }

File is not uploading!!!

dd() is giving me this output:

https://ibb.co/55cd2Xb

Activity icon

Started a new Conversation How To Show Place With Latitude And Longitude?

I am working with the Google Takeout. They give me data with json file.

  "timelineObjects" : [ {
    "placeVisit" : {
      "location" : {
        "latitudeE7" : 129255490,
        "longitudeE7" : 776649940,
        "placeId" : "ChIJ_ZQgWXcTrjsR7t4Sqb3Pmi8",
        "address" : "#101, 10th Block, Suncity Corporate Leisure\nSarjapura Outer Ring Road\nIblur Village, Bellandur\nBengaluru, Karnataka 560102\nIndia",
        "name" : "Cheese Care",
        "locationConfidence" : 99.093636
      },
      "duration" : {
        "startTimestampMs" : "1358972055436",
        "endTimestampMs" : "1360407467023"
      },
      "centerLatE7" : 129255325,
      "centerLngE7" : 776650031,
      "visitConfidence" : 64,



      "otherCandidateLocations" : [ {
        "latitudeE7" : 129253900,
        "longitudeE7" : 776647590,
        "placeId" : "ChIJjwwbqoITrjsR95ZXtjEF2tU",
        "name" : "Zenith",
        "locationConfidence" : 0.5477843
      }],


      "editConfirmationStatus" : "NOT_CONFIRMED"
    }
  } ]
}

I didn't get any idea how to show places with these latitudeE7 and longitudeE7. They are very big value!!!

Mar
23
2 months ago
Activity icon

Replied to Select2 Problem

@dingomall,

That will be great.

Activity icon

Replied to Select2 Problem

@gzai,

Your solution helped me. Thanks

$(window).click(function() {
	$("[name='country']").select2('close');
});
Mar
21
2 months ago
Activity icon

Replied to How To Get First Letter Of First & Last Name

@all,

My Question is not how to calculate it. I know how to calculate it. But my question is, in Vue.JS how will I pass the name to Compute it?

Mar
18
2 months ago
Activity icon

Started a new Conversation How To Get First Letter Of First & Last Name

Suppose, My Name is "Aerofoil Todo Kite" I want AK

I got a code from Stackoverflow. I hope it will work. But my question is, I am printing data from Array of Objects with v-for loop.

How do I pass the Name to compute that?

I think, Computed Property don't accept Parameter.

Then what will be the process??

Method can do. But It is calling for many times!!!

data:

tableData: [
  { customer: 'EE Fashion'}, 
  { customer: 'Tom Hangs Ron'}
}]

methods: {
 nameOfCompany(fullName) {
     console.log(fullName);
     return "HL";
 }
}

Code of Mine:

<template slot-scope="scope">
    <p style="margin-top: 5px;"><b>{{ nameOfCompany(scope.row.customer) }}</b></p>
 </template>

Here is the problem: {{ nameOfCompany(scope.row.customer) }}

This function is calling for many times!!!!

Activity icon

Started a new Conversation Select2 Problem

I am using Select2 for my Select-Option. But I am facing a strange problem!!

https://gifyu.com/image/IAy4

Please see this gif.

While I clicking outside without selecting an option then the select2 search bar and results are remaining!!!

What is the problem?

My Code:

<div class="form-group">
      <label for="country" class="countrySelectLabel">Country</label>
      <select name="country" style="width: 100%!important;">
          <option value="US" selected>USA</option>
      </select>
</div>

Initialisation Code:

$("[name='country']").select2({
    placeholder: "Select a country",
    templateResult: formatCountry,
    data: isoCountries,
    templateSelection: selectedCountry,
});
Mar
17
2 months ago
Activity icon

Started a new Conversation Push To An Existing Code To An Existing Repository: Bitcucket

I have a private repository (Suppose: rental)

I pushed some to code to it. Now I want to push another project to that repository. Clearly, I want to replace the previous code with new one.

With command line what will be the procedure?

git remote show origin


* remote origin
  Fetch URL: https://[email protected]/xxxxx/rental.git
  Remote branch:
    master new (next fetch will store in remotes/origin)
  Local ref configured for 'git push':
    master pushes to master (local out of date)

This is now the condition.

I am trying with these commands:

1. git init
2. git commit -m "New Commit"

Giving me this error:

On branch master
Your branch is up to date with 'github/master'.
nothing to commit, working tree clean
Mar
11
2 months ago
Activity icon

Replied to How To Get This Json File From A Component: Vue

@tykus,

Trying to get data using Axios. :-P

Activity icon

Replied to How To Get This Json File From A Component: Vue

@sti3bas,

Then how will I put it into points array??

Activity icon

Started a new Conversation How To Get This Json File From A Component: Vue

I want to get a json file from a Component.

This is the folder structure.

https://ibb.co/MBhFhr5

Vue.axios.get('../../../../../dataA.json', {}, function(response) {
     data = JSON.parse(response);
      var points = [].concat.apply([], data.map(function (track) {
       return track.map(function (seg) {
            return seg.coord.concat([1]);
     });
  }));
})

But giving me error:

304 Not Modified
Mar
10
2 months ago
Activity icon

Replied to Laravel Not Show New Image After Editing Only If Remove Cache

@fedaaelmasri,

storeAs() is generally used when a file is already uploaded. So, it can create problem witih cache. You can use move()

$request->image->move(public_path('images/brands'), $imageName);