Snapey

Director at Novate Ltd

Member Since 6 Years Ago

Mansfield

Experience Points
1,953,025
Total
Experience

0 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
1361
Lessons
Completed
Best Reply Awards
2765
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 50
1,953,025 XP
Sep
26
1 day ago
Activity icon

Replied to How To Create A Slug When Importing A Csv File

looking at the docs for csv seeder I cant see how you can do anything to the data on a per row basis. The only thing similar is the hash function

Whatever value you state as the default will be applied with the same value into every row

Does the seed data change often? I would consider creating a slug column in excel then you only need to modify the source data once ?

Activity icon

Replied to How To Create A Slug When Importing A Csv File

The SlugService class:

Generally, you don't need to access this class directly, although there is one static method that can be used to generate a slug for a given string without actually creating or saving an associated model.

The issue really is that you give no context of where you use this code, and why you cannot just use the sluggable function in your model?

Activity icon

Replied to How To Create A Slug When Importing A Csv File

replace 'name' with a concatenation of the fields

Activity icon

Replied to Laravel Maintenance --render And --secret Not Working

the upgrade guide covers the steps needed. Should not be too complicated.

Activity icon

Replied to Alpine : Show / Hide Div Based On Select Value

how can it ever change if its not showing?

Activity icon

Replied to Best Way To Save Credit Cart Info

anyone accepting card payments must be PCI compliant

Activity icon

Replied to Best Way To Save Credit Cart Info

Even in your country, its probably illegal to store the customer's credit card details - especially if your customers might be from other countries.

https://www.fisglobal.com/en/insights/merchant-solutions-worldpay/article/what-you-need-to-know-about-pci-compliance-levels

Activity icon

Replied to Laravel Maintenance --render And --secret Not Working

What do you get with php artisan -V

Those options are only available in version 8

Activity icon

Awarded Best Reply on Livewire Component (Updating String Data)

The status variable is only pushed to the client when the render method runs at the end of the process.

It is not 'live' two-way binding . Its only live in that changing a variable in the client causes it to be pushed to the server. The server does its work and then renders the view again. The client updates anything that is different.

In your example, there is nothing flowing to the client when you change status

If this is a long running process (eg 10's of seconds) then you could use poll attached to the view to check on the current progress.

Activity icon

Awarded Best Reply on Default Value Not Set? $table->timestamp('due_date')->nullable();

$fillable only comes into play with mass assignment - which is not what you are doing

Sounds like you have not run the migrations to refresh the table? Did you add nullable after initially creating the column?

Activity icon

Replied to Default Value Not Set? $table->timestamp('due_date')->nullable();

$fillable only comes into play with mass assignment - which is not what you are doing

Sounds like you have not run the migrations to refresh the table? Did you add nullable after initially creating the column?

Activity icon

Replied to Livewire Component (Updating String Data)

The status variable is only pushed to the client when the render method runs at the end of the process.

It is not 'live' two-way binding . Its only live in that changing a variable in the client causes it to be pushed to the server. The server does its work and then renders the view again. The client updates anything that is different.

In your example, there is nothing flowing to the client when you change status

If this is a long running process (eg 10's of seconds) then you could use poll attached to the view to check on the current progress.

Activity icon

Replied to Checkbox Stores 0 Whatever Value The User Enters

Why, I don't think you followed one thing that I showed ?

Activity icon

Replied to 403 Forbidden Access To This Resource On The Server Is Denied!

Your screenshot is incorrect

You should have the Laravel project installed in a folder alongside the public_html folder

You should have the content of the public folder in a subdirectory of public_html

Therefore storage & bootstrap should not be in the same folder as index.php and .htaccess

Activity icon

Replied to 403 Forbidden Access To This Resource On The Server Is Denied!

Auto index is when you try to access a folder that has no default page and no .htaccess

Activity icon

Replied to Laravel Observer Not Udpating Value

What I found

increment() does call the updating event, but not the saving event

Changes to the model during the updating event are not affecting the stored data (as though the updating function is only receiving a copy of the model)

I cannot find any articles or forum responses relating to changing the content of the model during the updating event, which seems to be a bit counter-intuitive to what would be expected.

See https://github.com/laravel/framework/issues/32567

The 'special case' around increment and decrement is that they are supposed to be atomic so that the column can be read and incremented by the database in a single transaction. As such, its not like a typical model change.

Activity icon

Replied to 403 Forbidden Access To This Resource On The Server Is Denied!

You need to make sure that the storage folder in the subdomain folder is writable

If it is, then you should see a log file being created with the 500 error which will tell you the next step

Activity icon

Replied to 403 Forbidden Access To This Resource On The Server Is Denied!

You are trying to install in a folder, not a subdomain ?

Activity icon

Replied to Laravel Time Format

Not a Laravel question. Have you tried MDN ?

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/time

You should read this and note also the browser support.

Activity icon

Replied to 403 Forbidden Access To This Resource On The Server Is Denied!

How can we help if you don't describe what you are trying to do?

Deployment on subdomain is easy, but it depends where you put your code and what your document root is.

The fact that you say "permissions for public_html" tells me you are already going to struggle since Laravel expects your public folder to be public

You can work around this, but the answer is not to just throw everything into public_html

Activity icon

Replied to Calculate No. Of Financial Year Between Two Dates

inclusive of partial years, or only the full years?

Activity icon

Replied to Undefined Variable: Tasks Laravel 8x Livewire

Trying to get property 'profile_photo_url' of non-object

has nothing to do with this code?

Its probably an image in your header which you are trying to show even when you are not logged in

Activity icon

Replied to How To Transfer Or Convert Data When Doing A Database Migration!

I dont see a problem translating table data in a migration file, but relying on the current state of other tables I can see would be a problem.

I have tackled things like this in custom artisan commands, but the problem with these is knowing when to run, and how such a command might be run within a deployment pipeline

Either is still preferable to running custom sql scripts in db tools as there is no control over these

Activity icon

Replied to How To Transfer Or Convert Data When Doing A Database Migration!

Sounds like you already know the answers

Migrations are to change the schema; add columns and drop columns.

Migrations do nothing for modifying the data, for that you need to write some custom script either in php or in sql.

Migration files can contain any PHP script, so in your made up example, you could include code to convert age into DOB (if that were even possible!) and then a further section to drop the original column.

Putting the transformation into your migration file means that it is only executed once and is stored in your VCS

Sep
25
2 days ago
Activity icon

Awarded Best Reply on Laravel 8 Command Schema:dump

you need to make sure mysqldump is in your path so that it can be executed by artisan

Activity icon

Replied to How To Validate A Date, Or A String.

how can you store this state in your database?

Better to have a boolean that tells you if the date is used then you can store both released and release_date

Activity icon

Replied to Laravel 8 Command Schema:dump

you need to make sure mysqldump is in your path so that it can be executed by artisan

Activity icon

Replied to Scheduler Not Working After Moving Servers

note that you have environments constraint on your tasks

check that the new server has one of the two mentioned environments

check with php artisan tinker

>>> config('app')
Activity icon

Replied to How To Write Blade View With Pagination

your view does not care which page it is on. It receives an array of articles that are zero based, irrespective of page number. You could hard code it for instance;

<table>

<tr>
    <td rowspan='3' colspan='2' >Header article</td>
    <td>articles[0]</td>
    <td>articles[1]</td>
</tr>
<tr>
    <td>articles[2]</td>
    <td>articles[3]</td>
</tr>
<tr>
    <td>articles[4]</td>
    <td>articles[5]</td>

etc

page 2 would be identical....

Activity icon

Replied to Error In Displaying Image Laravel 7 Invalid Argument Supplied For Foreach()

have you added something to the model to automatically cast the json array as a php array?

Activity icon

Replied to Scheduler Not Working After Moving Servers

also make sure the timezone is correct. If you are in a timezone that is offset by 15 minutes, the job you expect to occur every :00 then actually it might only execute at :15

Activity icon

Replied to Store Value Globally In Controller

yes, thats more like it, so to make it work long term you have two options

  • only remember the key for the duration the api states. change rememberForever to remember and then add the cache duration. I would pick maybe 50% of the token lifetime

  • leave the code as it is, then when you get an error from the api where the bearer token is expired, flush it from the cache and the repeat the call

I would probably end up doing both

Sep
24
3 days ago
Activity icon

Replied to Store Value Globally In Controller

no because this

return $res_body->access_token;

does not include all the steps to get a token

Activity icon

Replied to Sending Mails Without Smtp - Laravel 7

use a mail server and ensure you send email FROM an address that is authorised sender for that domain.

You cannot just hack your way past this and expect your email to be delivered. Its just not going to happen.

Activity icon

Replied to Store Value Globally In Controller

10 hours makes sense

Your function to get the key needs to include all the steps. at the moment it just gets a local parameter

Activity icon

Replied to Button Not Responding In Livewire

wrap your original code in a single div?

Activity icon

Replied to Button Not Responding In Livewire

don't you need to listen for addNew event ?

Activity icon

Replied to Store Value Globally In Controller

Does the 36000 expire time refer to ms?

How could I possibly know?

You have some code to get the api key. When you get it, store it in the cache.

In my example, this would be the getApiKey() function. The value it returns is stored in cache, then when you do another api request, it gets it from the cache and not by calling the api again

Activity icon

Replied to Checkbox Stores 0 Whatever Value The User Enters

You dont have anything in the detail table?

Activity icon

Replied to Store Value Globally In Controller

@geordiejackson we've moved on from sessions

Activity icon

Replied to Store Value Globally In Controller

see updated answer

Activity icon

Replied to Store Value Globally In Controller

the token will almost certainly expire so you need to consider this

So you need to programatically save a value. Probably easiest is to store in cache with remember forever

Wrap your function that returns the api code in a cache callback

$key = Cache::rememberForever('payment_token', function () {
    return getApiKey();
});
Activity icon

Replied to Sending Mails Without Smtp - Laravel 7

you need a mail server to forward your mails to. It will then send to recipient.

Activity icon

Replied to Store Value Globally In Controller

session is per user and is lost if they logout or their session ends

As we dont know what you are trying to share, and why, how can we possibly advise?

Activity icon

Replied to Auth In Laravel 8.x - What Run In Cmd Line Artisan

jetstream uses tailwind