Tjyoung

Tjyoung

Member Since 5 Years Ago

Experience Points
6,100
Total
Experience

3,900 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
83
Lessons
Completed
Best Reply Awards
0
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 2
6,100 XP
Jun
09
4 months ago
Activity icon

Replied to Video On Demand

Hi, ziggeo has their push service that you can specify your s3 storage and have it place the transcoded video there. The videos typically have a unique name so in essence ‘security by obscurity’. Mine for example are the video token each is named after (a 32 character unique string).mp4. Stored on S3 and accessible to the app only because you’d have to know the URL to access it which would be very challenging for someone to guess etc.

Jun
07
4 months ago
Activity icon

Replied to Maintaining Laravel App

I had same issue but was stuck at 5.0 Was basically impossible to upgrade as it was so far gone and ended up rewriting on 7 for four months. Lesson learned. Good to have a plan in place from day one

Activity icon

Replied to Max_questions Limit Being Hit

Thanks. Turns out I was able to change the value using tablePlus under user management . Didn’t know this was even a thing lol

Activity icon

Replied to Video On Demand

Maybe use ziggeo There is a cost but you can host them on your aws account and stream It does all the encoding etc Provides a player etc We have done roughly 200,000 videos so far this way

Jun
06
4 months ago
Activity icon

Replied to Is There Any Support For Laravel Forge At All?

thanks forgot all about that. Takes a day or two for a one sentence answer, but nevertheless.. someone wrote back

Activity icon

Started a new Conversation Max_questions Limit Being Hit

HI, can't figure out how to change max_questions limit. I'm on laravel forge ec2 amazon server Getting error the user has hit the max_questions limit. I need to change this value, but I'm unable to figure out where can I do this?

Activity icon

Replied to How To Upload Bulk Questions From Excel Sheet To Database In Laravel

Using Navcat or tableplus MySQL admin your would just export as csv, ensure headers are same in csv as table and import

Activity icon

Started a new Conversation How To Handle Remote Csv File Fetch, And Update/insert Table If Exists Or Not

HI, I'm on forge using scheduler and running a command each hour with below to get a remote csv, import into my DB. Using Laravel Excel to import the rows into my DB table 'vehicles'

*I should point out I'm a bit of a newbie and may be missing something glaring so please don't hesitate to point out what should be obvious as well :)

public function handle() {

    $url = "http://otherdomain.com/remotefile.csv";
    $contents = file_get_contents($url);

    if($contents !== false AND !empty($contents))
    {

        DB::table('vehicles')->truncate(); // clear the table

        $name = "remotefile.csv";
        Storage::put($name, $contents);
        $vehicles = storage_path($name);
        Excel::import(new InventoryImport, $vehicles);
        Storage::delete($name); // get rid of the downloaded file

        return(200);

	} else {

        return(404);
    }
}

My InventoryImport file looks like:

namespace App\Imports;

use App\Vehicle; use Maatwebsite\Excel\Concerns\ToModel; use Maatwebsite\Excel\Concerns\WithStartRow;

class InventoryImport implements ToModel, WithStartRow {

public function startRow(): int
{
    return 2; // doing this to skip header row
}

// now importing file into DB

public function model(array $row)
{
    return new Vehicle([
       'LastModified'               => $row[0],
       'Type'                              => $row[1],
       'VIN'                                 => $row[2],
   etc. etc. with additional fields
    ]);
}

}

So after the above, it works fine and is imported into my Database as expected. Just a simple fetch file and import it into DB

The problem is: I really only want to fetch the file and check each row to see:

  1. does it exist already (using the VIN as the unique identifier) and if so, has it been modified since my last import (LastModified). If it has been modified since last time UPDATE that record

  2. if record doesn't exist, then do INSERT with new record

  3. if there are records I have in my DB prior that doesn't exist in the new imported file, then delete those records

So with regards to the third point... I'm guessing I could when I go to check the newly downloaded file against the existing table, I could update all the records in the DB to value of '1' in a column (ie: DoesExist with a default value of 0) just prior and for each record I check that exists or is a new insert, I could set that column back to '0'.

At the end of the file, I could simply delete all the records that are still set to a 1.

not sure if there is a better way to handle point 3?

So my big challenges are: How do I fetch the csv, parse it and check each row prior to insert? If exists, update if file has been modified since last time. If doesn't exist, insert.

Any help is much appreciated. Struggling with this one as you can see

May
21
5 months ago
Activity icon

Replied to Attach Calendar With Email In Php

I'm a code butcher but feel free to use any below to get the idea going. This is part of a controller I did for generating a calendar file for a video that was sent with a button to add to ical:

$ical = " BEGIN:VCALENDAR VERSION:2.0 CALSCALE:GREGORIAN BEGIN:VEVENT UID:" . md5(uniqid(mt_rand(), true)) ."".$domain." DTSTAMP:" . gmdate('Ymd').'T'. gmdate('His') . " DTSTART;TZID=".$dealer->timezone.":".str_replace('-', '', $date)."T".str_replace(':', '', $startTime)." DTEND;TZID=".$dealer->timezone.":".str_replace('-', '', $date)."T".str_replace(':', '', $endTime)." SUMMARY:".$subject." LOCATION:".$video->FromAddress.", ".$video->FromCity." ".$video->FromPostal." DESCRIPTION:".$desc." URL:http://www.somesite.com" BEGIN:VALARM TRIGGER:-PT30M DESCRIPTION:Appointment Reminder ACTION:DISPLAY END:VALARM END:VEVENT END:VCALENDAR"; header('Content-type: text/Calendar; charset=utf-8'); header('Content-Disposition: inline; filename=calendar.ics'); echo $ical;

Activity icon

Started a new Conversation Is There Any Support For Laravel Forge At All?

Woke up this AM and the site in development on forge was down 500 error. Not sure what was happening. Logs are pointless and started guessing may inode as it was saying get_file_contents disk space not available though its a large AWS server with nothing else on it but a small dev site, no active users. I was running a few commands fetching data through an API every 5min so maybe that was it.

Anyways, could not rectify. Thought I'd uninstall rep and start over. Did that and then it just spins endlessly on 'uninstalling repository' for an hour now. So, decided to 'delete' the site altogether. Now I see a message it couldn't delete the site and is still spinning on uninstall repository.

concerns me I don't have anyone to turn to when things go off the rails.

Any ideas/input are welcome.

May
02
5 months ago
Activity icon

Replied to Timezone Issue Need To Convert From This: 2020-01-06T17:56:43.457Z'

Yes thanks! Ended up with: Carbon::parse($employee->LastUpdate)->format('Y-m-d H:i:s'); works great.

Activity icon

Started a new Conversation Timezone Issue Need To Convert From This: 2020-01-06T17:56:43.457Z'

Hi, I apologize if this is a really 'easy' question. I have searched the net but can't find a definitive answer. I'm importing through an API a timestamp. Comes in like this: 2020-01-06T17:56:43.457Z'

I need to convert that into a datetime stamp like: 2020-01-06 17:56:43

I thought in the past, mysql simply handled this when inserting but I'm getting an error when running a artisan command: SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: '2020-01-06T17:56:43.457Z'

Can you suggest how best to handle this?? Thanks as always

Apr
30
5 months ago
Activity icon

Replied to WhereIn Works, But WhereNotIn Doesn't... Please Help. Dying.

THANK YOU! I don't know how I didn't see the docs. Gave me 14 back as it should Using whereExists did the opposite of course giving me 2 results (numbers in the users table).

Anyways, really appreciate it.

Activity icon

Replied to WhereIn Works, But WhereNotIn Doesn't... Please Help. Dying.

going to read docs right now. May have jumped the gun trying

Activity icon

Replied to WhereIn Works, But WhereNotIn Doesn't... Please Help. Dying.

Got this: Argument 1 passed to Illuminate\Database\Query\Builder::whereExists() must be an instance of Closure, string given

Activity icon

Started a new Conversation WhereIn Works, But WhereNotIn Doesn't... Please Help. Dying.

Hi, I have a pretty straightforward query. Its supposed to get all the numbers in the 'dealership_numbers' table that DOESN'T exist in the 'users' table.

As it stands: There are 16 numbers in total in the 'dealership_numbers' table. There are 2 numbers that match in the 'users' table that are in the dealership_numbers table

Below query returns zero results as is. I am expecting 14 numbers returned from the 'dealership_numbers table'.

If I change the 'whereNotIn' to 'whereIn' I get 2 phone numbers back which makes sense according to my tables (I have 2 users in the users table that each have a number from the 'dealership_numbers' table).

Query returning zero results: $connect_numbers = DB::table("dealership_numbers") ->select('*') ->whereNotIn('phone_number',function($query){ $query ->select('users_phone') ->from('users'); }) ->get();

Same query returning 2results (only diff is whereIn): $connect_numbers = DB::table("dealership_numbers") ->select('*') ->whereIn('phone_number',function($query){ $query ->select('users_phone') ->from('users'); }) ->get();

Any idea what I'm doing wrong??

Apr
27
6 months ago
Activity icon

Replied to Can't Figure Out This Forge Error

no that was all I had. I will comb through my files.

Activity icon

Started a new Conversation Can't Figure Out This Forge Error

Hi, getting an error when deploying. All seems fine except the last line shown below. any idea how to troubleshoot this?

Loading composer repositories with package information Installing dependencies (including require-dev) from lock file Nothing to install or update Generating optimized autoload files

Illuminate\Foundation\ComposerScripts::postAutoloadDump @php artisan package:discover --ansi Discovered Package: facade/ignition Discovered Package: fideloper/proxy Discovered Package: fruitcake/laravel-cors Discovered Package: intervention/image Discovered Package: laravel/tinker Discovered Package: laravel/ui Discovered Package: maatwebsite/excel Discovered Package: nesbot/carbon Discovered Package: nunomaduro/collision Discovered Package: spatie/laravel-permission Discovered Package: vinkla/hashids Discovered Package: yajra/laravel-datatables-oracle Package manifest generated successfully. Restarting FPM... /home/forge/.forge/provision-4248697.sh: line 18: syntax error: unexpected end of file