undefined_variable

undefined_variable

Member Since 8 Months Ago

Experience Points
5,550
Total
Experience

4,450 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
48
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start-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-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-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist 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 2
5,550 XP
Dec
07
2 months ago
Activity icon

Started a new Conversation Google Autocomplete Doesnt Work When Compiled With Mix, Why Is That?

Google autocomplete doesnt work when compiled with mix, why is that?

So I'm trying to clean things up a bit, and I want to put the google autocomplete code in its own js file and compile it for the public directory

looking in view source I can see the compiled code if I click the file, so everything is wired up correctly

And if I overwrite the compiled code in public/js with the original uncompiled code, everything works fine,

this is the error I get in chrome console

address:1 Uncaught (in promise) Ed {message: "initAutocomplete is not a function", name: "InvalidValueError", stack: "Error↵    at new Ed (https://maps.googleapis.com/m…ibraries=places&callback=initAutocomplete:149:124"}
Promise.then (async)
kj @ js?key={hidden}&libraries=places&callback=initAutocomplete:149
google.maps.Load @ js?key={hidden}g&libraries=places&callback=initAutocomplete:21
(anonymous) @ js?key={hidden}&libraries=places&callback=initAutocomplete:245
(anonymous) @ js?key={hidden}&libraries=places&callback=initAutocomplete:245
4address:150 Uncaught ReferenceError: geolocate is not defined
    at HTMLInputElement.onfocus (address:150)

this is the uncompiled autocomplete code

   // This example displays an address form, using the autocomplete feature
        // of the Google Places API to help users fill in the information.
      
        // This example requires the Places library. Include the libraries=places
        // parameter when you first load the API. For example:
        // <script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&libraries=places">
      
        var placeSearch, autocomplete;
      
        var componentForm = {
          street_number: 'short_name',
          route: 'long_name',
          locality: 'long_name',
          administrative_area_level_1: 'short_name',
          country: 'long_name',
          postal_code: 'short_name'
        };
      
        function initAutocomplete() {
          // Create the autocomplete object, restricting the search to geographical
          // location types.
          autocomplete = new google.maps.places.Autocomplete(
            document.getElementById('address'), {
              types: ['geocode']
            });    
          autocomplete.setFields(['address_component']);      
          // When the user selects an address from the dropdown, populate the address
          // fields in the form.      
        }
      
      
        // Bias the autocomplete object to the user's geographical location,
        // as supplied by the browser's 'navigator.geolocation' object.     
        function geolocate() {
          if (navigator.geolocation) {
            navigator.geolocation.getCurrentPosition(function(position) {
              var geolocation = {
                lat: position.coords.latitude,
                lng: position.coords.longitude,
                acc: position.coords.accuracy
              };      
              lat = geolocation.lat;
              lng = geolocation.lng;
              acc = geolocation.acc;
      
              var circle = new google.maps.Circle({
                center: geolocation,
                radius: position.coords.accuracy
              });
              autocomplete.setBounds(circle.getBounds());
            });
          }
        }

This is how I access it

@push('head')
<script
    src="https://maps.googleapis.com/maps/api/js?key={{ config('app.google_maps_api') }}&libraries=places&callback=initAutocomplete"
    async defer>
</script>

<script src="{{ mix('js/autocomplete.js') }}" async defer></script>

@endpush

And the user input

   <input class="form-control form-control-lg" type="text" name="address" id="address" onFocus="geolocate()"
                                        placeholder="Enter your address">
Nov
28
2 months ago
Activity icon

Started a new Conversation Omg Help, Ive Just Jacked My Production Server

So basically i needed to make some quick adjustments, and I do have telescope installed locally as a dev dependancy and have had no issues, but it wasnt working so i ran artisan telescope:install.

turns out the issue was that I didnt migrate the db for the telescope entries.

after my adjustments I noticed telescope added itself to config,app when i git pushed.

anyway I get error when i try to deploy on forge Class 'Laravel\Telescope\TelescopeApplicationServiceProvider' not found

I removed this dependancy, ive ran composer remove laravel/telescope and ive deleted telescope from app/providers

I can now run composer install --no-dev locally no problems

but forge is still saying it cant find telescope, I dont know how as I've removed it so why is it looking for it?

this is part of my deploy script.

git pull origin master

composer install --no-interaction --prefer-dist --optimize-autoloader --no-dev

php artisan migrate --force

What do I do?

Nov
13
3 months ago
Activity icon

Awarded Best Reply on Cant Ssh Into Forge Aws Server

Found solution here https://serverfault.com/questions/599909/laravel-forge-ssh-on-windows-not-recognized

only took another 3 hours of my life of more unpaid labour

at this rate when I hit retirement age I should hopefully be ready for a junior role

Activity icon

Replied to Cant Ssh Into Forge Aws Server

Found solution here https://serverfault.com/questions/599909/laravel-forge-ssh-on-windows-not-recognized

only took another 3 hours of my life of more unpaid labour

at this rate when I hit retirement age I should hopefully be ready for a junior role

Activity icon

Replied to Cant Ssh Into Forge Aws Server

Ive just fired up another server on forge at vultr,

Ive made a new key pair

ive added the public key to the ssh section and forge

Ive tried using putty to log in using the private key and usersname 'forge'

And I get key refused.

Im obviously forgeting some cruicial step here.

any ideas anyone please.

Activity icon

Started a new Conversation Cant Ssh Into Forge Aws Server

hi,

Yesterday ive fired up a new aws server in forge, I have used the forge deploy tool to pull the site from git, no problem, site is up.

But I can not ssh into it.

Im using login : forge

I have added the public key, and Ive tried adding the key 3 different ways in forge ssh keys section

1: completely as it looks.

2: I have tied adding only the characters without these lines

---- BEGIN SSH2 PUBLIC KEY ----
(coment: "rsa-key....) 
---- END SSH2 PUBLIC KEY ----

3: and lastly Ive tried adding without the above comments and just the characters whilst removing the new lines, so adding as 1 long string.

But I always get from putty

Server refused our key.

and then a popup

Disconnected no supported authentication methods available (server sent: publickey)

So what have I forgotten to do?.

I can putty into my other forge vultr server no problem.

Oct
29
3 months ago
Activity icon

Commented on Reduce Duplication

How does $fillable protect anything, if admins and users share the same model.

Could you or should you have seperate $fillables like this example?

protected $fillable = ['name', 'password'];

if (admin == true) {
protected $fillable = ['name', 'password',' subscriber'];
}
Aug
27
5 months ago
Activity icon

Started a new Conversation Is This A Bug Or A Feature

So I have these 2 queries, and I pass quotesTotal and quotesToday to the view.

$quotes = Quote::where('owner_id', Auth()->id());

        $quotesTotal = $quotes->count();

        $quotesToday = $quotes
            ->whereYear('created_at', date('Y'))
            ->whereMonth('created_at', date('m'))
            ->whereDay('created_at', date('d'))
            ->count();

However I wanted to add a exclusion, so I change to this, and I noticed it effects both quotesTotal and quotesToday

$quotes = Quote::where('owner_id', Auth()->id());

        $quotesTotal = $quotes->where('internal', '!=', 1)->count();

        $quotesToday = $quotes
            ->whereYear('created_at', date('Y'))
            ->whereMonth('created_at', date('m'))
            ->whereDay('created_at', date('d'))
            ->count();

I dont understand how it can effect quotesToday variable.

telescope log

select
  count(*) as aggregate
from
  `quotes`
where
  `owner_id` = 91
  and `internal` != 1
select
  count(*) as aggregate
from
  `quotes`
where
  `owner_id` = 91
  and `internal` != 1
  and year(`created_at`) = "2019"
  and month(`created_at`) = "08"
  and day(`created_at`) = "27"```
Aug
23
6 months ago
Activity icon

Started a new Conversation Stripe Webhook Route In Api.php Or Web.php And Exclude Csrf

Hi,

Everything I've searched for seems everyone puts the route in web.php and excludes the csrf.

However all the awnsers are old and maybe thats how it needed to be done then.

Is there any reason or security risk to not just put the route in api.php and therefore no need to worry about csrf?