Member Since 5 Months Ago
4,710 experience to go until the next level!
In case you were wondering, you earn Laracasts experience when you:
Earned once you have completed your first Laracasts lesson.
Earned once you have earned your first 1000 experience points.
Earned when you have been with Laracasts for 1 year.
Earned when you have been with Laracasts for 2 years.
Earned when you have been with Laracasts for 3 years.
Earned when you have been with Laracasts for 4 years.
Earned when you have been with Laracasts for 5 years.
Earned when at least one Laracasts series has been fully completed.
Earned after your first post on the Laracasts forum.
Earned once 100 Laracasts lessons have been completed.
Earned once you receive your first "Best Reply" award on the Laracasts forum.
Earned if you are a paying Laracasts subscriber.
Earned if you have a lifetime subscription to Laracasts.
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.
Earned once you have achieved 500 forum replies.
Earned once your experience points passes 100,000.
Earned once your experience points hits 10,000.
Earned once 1000 Laracasts lessons have been completed.
Earned once your "Best Reply" award count is 100 or more.
Earned once your experience points passes 1 million.
Earned once your experience points ranks in the top 50 of all Laracasts users.
Earned once your experience points ranks in the top 10 of all Laracasts users.
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.
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.
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....
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!
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.
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.
?
Any help would be appreciated. Thank you!
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.
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.