pauladams8

pauladams8

Member Since 1 Year Ago

Experience Points
12,470
Total
Experience

2,530 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
121
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 3
12,470 XP
Jun
14
3 months ago
Activity icon

Started a new Conversation Unit Testing And The Database

I'm looking for advice regarding unit testing and the database.

I know testing best practice is a very opinionated topic which different developer communities disagree on, but I wanted to know if the Laravel community has a preferred approach to unit testing.

My Laravel app is dependent on Eloquent and there are references to Eloquent persistence methods and model relations everywhere.

I want to unit test functionality in my application that isn't related to database persistence, and to my knowledge, unit testing by definition means testing in isolation (i.e. without talking to the database / network).

However, I am struggling at the moment because the classes I want to test depend on Eloquent models and specifically, relations, which are retrieved from the database through PHP's magic accessor (__get__).

Typically when I need to test a class in isolation of its dependencies, I will mock the dependencies using a "dumb" placeholder object which fulfils the dependency contract while ensuring external factors cannot affect the outcome of the test. It seems a lot of unnecessary work to mock Eloquent models though.

There are a few solutions I have considered:

  • Give up on trying to "unit" test and just accept my app requires a database connection (could use an in memory SQLite database for example)
  • Abstract the persistence logic via a repository (which could be mocked more easily)
  • Mock the Eloquent models (not my favourite solution as I've got better things to do)

I'm assuming others have encountered this problem before, so what would you recommend?

Jun
06
3 months ago
Activity icon

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

You could try exporting the Excel spreadsheet in CSV format (File > Save as and choose CSV as the format).

Then, in your application you could accept the CSV file in a form parameter and parse it server side.

Take a look at https://www.php.net/manual/en/function.str-getcsv.php.

May
29
3 months ago
Activity icon

Started a new Conversation SQL Auto Increment Attribute

In SQL, it is possible to define a starting auto increment value other than the default of 1 (see docs https://dev.mysql.com/doc/refman/8.0/en/example-auto-increment.html).

How would I define this auto increment value on a database migration in Laravel?

When I supply a value to the ColumnDefinition autoIncrement() method, it doesn't show in the generated SQL, which reads "id" integer not null primary key autoincrement. I want the SQL definition to be "id" integer not null primary key autoincrement = 100.

May
03
4 months ago
Activity icon

Commented on Object-Oriented Forms: Part 2

Thanks for the episode. By the way, I think axios has a request() method which lets you pass in the method via a config object.

Example

axios.request({ method: 'GET', url: '/projects' })