Garet

Member Since 2 Years Ago

Experience Points
4,680
Total
Experience

320 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
21
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
4,680 XP
Jun
08
4 days ago
Activity icon

Replied to Best Way Of Calling Specific JavaScript Files For Particular Views

The way I've done it in the past from the controller is like this:

return view('users.edit', [
    'user' => $user,
    'js' => [
        'assets/js/users-edit.js',
        'assets/js/sortable.js',
        'https://some-external-cdn/something.js'
    ]
]);

Then in my master app.blade.php I'll output each item in the js array.

But it got me wondering recently who should be responsible for dictating the JavaScript files that are used, the controller, or the view?

Jun
07
5 days ago
Activity icon

Replied to Best Way Of Calling Specific JavaScript Files For Particular Views

Yes, stuff like edit-users.js and perhaps additional libraries like sortable.js

In the case of edit-users.js that would only be used on the Edit Users view, but some libraries like sortable.js might be used by multiple views, that require dynamic sort functionality.

Activity icon

Started a new Conversation Best Way Of Calling Specific JavaScript Files For Particular Views

I've approached this a few different ways, and I'm not sure which I like the most.

Let's say I have a particular controller and method, for example a users controller and an edit method along with an edit view. I might have a specific JavaScript file or files I want to include for that view to add some dynamic functionality.

The 2 main approaches I've used:

  1. Include the required JavaScript file(s) from the view itself. For example, extending a master layout which includes any global JavaScript files, and then adding my custom JavaScript files to the end.

  2. Specify the required JavaScript files from the controller, and pass them as an array to the view.

I'm leaning towards option 2 but can't decide what's best. What do you think?

May
23
2 weeks ago
Activity icon

Replied to JS Framework For Multi-page Laravel Application

For now, I have decided in my next project to ditch jQuery and rewrite things using vanilla JavaScript. I watched a few of the Vue videos, but for now I think Vue is an overkill for what we need, especially as we don't require a SPA.

Activity icon

Replied to Inserting Data Into Laravel Database From Non-Laravel App

Thanks for your advice, and sorry it has taken me a year to reply!

I sucessfully built this application, and created an API where the non-Laravel website can connect and insert orders into the Laravel app. Since it's imperative that no orders are ever lost, I also created a logging and notifcation system. If ever an order fails to be added due to a validation error, the error is logged and an email is sent to the administrator. After running it for 5 months there have been one or two failed orders due to bad data at the website end. So all in all, it has worked out really well.

Creating an API also means we could in theory move the app to a different server from the website, if we wanted to.

May
22
3 weeks ago
Activity icon

Replied to JS Framework For Multi-page Laravel Application

Thanks - one thing I notice is that the videos by Jeffrey for getting started with Vue cover Vue 2. I know there are videos for Vue 3 but it looks as though they assume you already have a reasonable understanding of Vue. Would it be wrong to start with Vue 2? I'd prefer not to have to learn everything twice.

Activity icon

Started a new Conversation JS Framework For Multi-page Laravel Application

I've built a few Laravel applications now which generally consist of both a front-end and back-end. Whilst they work beautifully they generally work the "old fashioned" way where each section of the app makes a request to the server, reloads the page and Laravel splits out a Blade view.

Occassionally I use a bit of jQuery to make some ajax calls if I want to update something on the page dynamically.

Lately I've been thinking about using Vue or React to make an application more dynamic. For example, add an item to a list without the page having to reload. However, all the examples and tutorials I find online seem to be exclusively related to building a Single Page Application (SPA). Perhaps I'm living in the dark ages, but this seems like an overkill for my needs.

I know it's a broad question, but I'm wondering how to get started using something like Vue or React but with a Laravel MPA rather than SPA.

I guess I envisage having my usual CRUD routes for a particular section of the app, but with some Vue components mixed in. I keep reading about routing in Vue and React, and I'm not sure that is at all relevant to what I'm trying to do.

Thanks

Mar
16
2 months ago
Activity icon

Started a new Conversation Telescope Shows Query Escaped Incorrectly

Please observe the following query, equivelant to the user input being Crotchet's

Entity::selectRaw('MATCH (name, seo_title) AGAINST (?) AS relevance', ["Crotchet's"])->get();

Telescope shows the query as:

select
  MATCH (name, seo_title) AGAINST ('crotchet\'s') AS relevance
from
  `entities`
where
  `entities`.`deleted_at` is null

All good so far.

However, let's say the user input is entered as Crotchet\'s and for reasons unknown to us, the user has placed a slash before their apostrophe:

Entity::selectRaw('MATCH (name, seo_title) AGAINST (?) AS relevance', ["Crotchet\'s"])->get();

The query runs fine so I belive it is escaped correctly. However, Telescope reports the query as:

select
  MATCH (name, seo_title) AGAINST (
    'crotchet\\' s ') AS relevance from `entities` where `entities`.`deleted_at` is null

Actually this is wrong, and if you copy and paste the above directly into the database engine of your choice, it will come back as a syntax error. The correct query should actually be:

select
  MATCH (name, seo_title) AGAINST (
    'crotchet\\\'s') AS relevance from `entities` where `entities`.`deleted_at` is null

Is this simply a bug with Telescope and the way the output is presented? Or something I'm overlooking?