sheldonfrith

Member Since 5 Months Ago

Experience Points
290
Total
Experience

4,710 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
2
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.

  • Community Pillar

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

Level 1
290 XP
Feb
25
1 month ago
Activity icon

Replied to Best Way To Generate And Serve Javascript Files (no Html) With Laravel?

... In the end I just ended up creating the javascript file as a string and sending it with an application/javascript content-type http response.

Jan
09
3 months ago
Activity icon

Replied to Best Way To Generate And Serve Javascript Files (no Html) With Laravel?

Some more context, incase my problem is unclear:

When my server gets a request from a script tag it is going to get a specific 'configuration' object based on the meta info of that request. This 'configuration' will specify, at least, a series of DOM manipulations and also React components+props which the js bundle sent back to the client needs to include. This configuration object is based on the business logic that I write in my Laravel models, etc.

The ideal solution would be if I could use Blade templates, and all the helpful features they include. However as far as I can tell blade templates can't generate plain javascript, it has to be wrappen in HTML.

Activity icon

Started a new Conversation Best Way To Generate And Serve Javascript Files (no Html) With Laravel?

I have read the docs front to back, and read every google article I could find, but I cannot find the information I need....

Context:

My server is going to be serving javascript bundles to <script> tags in client websites. When the server receives a request from one of these <script> tags it needs to dynamically generate the javascript bundle (using information from Laravel models) before serving it (I will be using caching, so probably most of the time it will just find a cached version instead of having to generate fresh code each time).

Here are the ways I have found that you can do this with Laravel, along with the problems I see with each approach. If there is another way, that doesn't have these problems, please let me know!

Known approaches (all flawed):

  1. Serve static js files from 'public' directory (aka. 'assets') and fill in the dynamic parts of the code by making requests back to the server from the client side. DRAWBACK: this will require many HTTP requests (ie. will be too expensive and slow), and seems silly since the information necessary is already present on the server from the start. And the Auth gets much more complicated.

  2. Keep everything in a Laravel PHP class (probably in a Controller), and generate the js files as strings using PHP. DRAWBACK: Working with js-formatted strings means I lose all IDE features that make writing JS reasonably fast. As the js I'm serving will be at least several hundred lines long, trying to write that as laravel strings seems like a real pain.

  3. ?

Any help would be appreciated. Thank you!

Oct
13
6 months ago
Activity icon

Replied to Unable To Create Or Change A Table Without A Primary Key - Create_oauth_auth_codes_table

I just fixed the problem (for me, not sure if this will work for others but posting it just in case):

Lets say I want to have "$table->string('your-col-name-here')->primary();" ... this will throw the error we are talking about because laravel sets the primary key AFTER making the table...

So first change it to "$table->id('your-col-name-here');" (which will set the primary key WHILE making the table)

Next use 'php artisan make:migration alter_table_name_here' to create a new migration.

In the new migration just do one thing: access the table you are having trouble with using 'Schema::table('table-name-here',....

in the nameless function change the type of the primary key column to be the type that you actually want it to be...

for me this meant "$table->string('your-col-name-here')->change();"

you will need to 'composure require doctrine/dbal'

and then just refresh or rollback+migrate and it should work.

Activity icon

Replied to Unable To Create Or Change A Table Without A Primary Key - Create_oauth_auth_codes_table

Also experiencing the same issue, just installed jetstream with inertia on a fresh install of laravel 8, cannot do anything because of this error.