mjoc1985

mjoc1985

Member Since 2 Years Ago

Fleetwood

Director/Owner at Sky Parking Services

Experience Points 20,940
Experience Level 5

4,060 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 206
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

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

09 Dec
1 year ago

mjoc1985 left a reply on Database Design Advice

@kobear I've just been playing around with the JSON option, which has actually turned out to be the solution that best fits. Now that I've updated MySQL on my server to 5.7 I don't lose out on being able to query my database and any of the attributes stored in the JSON column. I've not reduced my table column count from 39 to just 8!

I've been able to separate the pricing options into a price JSON column, as well as create a JSON column for product features and product settings.

I think I'm going to adopt this approach for the rest of my tables.

07 Dec
1 year ago

mjoc1985 left a reply on Database Design Advice

@TimMyers1968 that's interesting, I've never thought about creating views in MySQL so I'll take a look in to that.

@36864 That type of design sounds like it could improve things for me. Having a products table and then a separate attributes and attribute value tables could make it easier. If I can solve my current issues of having to create a new product table each time a different product type or supplier is included then that saves me a lot of development time.

@kobear My main concern is that at the moment if I add a new supplier or product that has a different set of attributes then I have increased development time to get all these things implemented. When it comes to maintenance it can get very messy as well.

I would love to only return a collection with a single list of products rather than having is retrieve multiple. This would reduce the complexity of my code somewhat and just generally make it easier to maintain.

I will definitely have a look at creating views with MySQL. It is something I haven't heard of before and sounds very interesting. Not sure how I would modify the Model classes to use the views though.

mjoc1985 left a reply on Database Design Advice

@36864 the products are things like airport parking, airport lounges, airport hotels etc. Each of these types would have basic info but then that's where the similarities end.

For example, parking products do not store prices because these are either fetched from external API or from a price file/table. Lounges, on the other hand, have static prices for adult, child and infant.

mjoc1985 left a reply on Database Design Advice

@36864 there are a handful of fields which all products, regardless of supplier, use. But then they all have different columns for the rest of the information which differ.

mjoc1985 started a new conversation Database Design Advice

I'm just looking for some advice on database design.

I have several types of products, some being internal and some that come from external sources/api, but I still store certain information for those products.

At the moment I have a separate table for my internal products and a separate table for products relating to each source/supplier.

When a customer requests a price for a range of products I query each of these tables prior to generating a price to present the quote. So when the information is presented to the frontend I end up with a collection of quotes like this:

return collect([
            'products' => $this->product->where('status', 'active')->get(),
            'externalOne' => $this->externalProductOne->where('status', 'active')->get(),
            'externalTwo' => $this->externalProductTwo->where('status', 'active')->get(),
        ])->all();
 

Where ideally I would just want this:

collect([
            'products' => $this->product->where('status', 'active')->get(),           
            
        ])->all();

As I source more suppliers for product ranges this is quickly becoming a pain in the arse to maintain and update. What I think I want to do now is bring all products into the same table but add in a category/type field which I can still use to determine which suppliers API I call for a price for that particular product range.

Each of the product categories all have different columns/fields of information stored which is why I initially created a table for each of the suppliers as the columns were different to my internal products. But they all share similar columns.

What would be the best way to tackle this? Should I create a table for each of the suppliers which just contains the columns related to that product range and then use Eloquent relationships to pull that information when I need it? Or, is there some other way where I could dynamically created fields/columns to store the different information, such as storing in one particular field as json?

If anyone managed to read this far without falling asleep and has some helpful advice for a newbie, I would greatly appreciate it!

27 Nov
1 year ago

mjoc1985 left a reply on Using Jobs To Return Data From API Calls

@martinbean Thanks for taking the time to put together this very informative example.

I hadn't even considered using broadcasting in combination with queued events. Just goes to show how valuable this community can be to newbies such as I.

I'm going to look into this and see what I can achieve.

Thanks again :)

mjoc1985 left a reply on Using Jobs To Return Data From API Calls

Thanks for the response @36864 .

It's all done on the website, so the user enters dates, times and location and the quote is displayed once it has been generated.

It's all time critical, as prices can change at any time and also each quote would usually be for a different date/time/location.

I understand that returning data from an asynchronous job isn't really do-able as it goes against the purpose of the job itself being queued, but I'm hoping to come up with a solution.

My idea is that as traffic increases and the number of quote requests per minute or even second increases I could queue the availability requests, show the user a "fetching your quotes" loading page and then once it has been processed display the results.

I'm a relatively new coder, and this is my first big project so it's still all a learning process. I may be missing something that is obvious to more experienced developers.

mjoc1985 started a new conversation Using Jobs To Return Data From API Calls

Hey all,

In my application, I have a function to generate an availability quote for a reservation system which returns a list of available products and prices from various suppliers. At the moment we currently have a combination of products stored internally and from 2 or 3 external suppliers which we interact with via their API.

What I want to do is for each quote request I want each availability check to an external API to be pushed to the queue and return the data from that job to build the quote response I then display to the user once the job has been processed. This is mainly to limit the number of API calls we make at once, as per the request of the external suppliers.

Can this be achieved using jobs, and is it a good idea?

Would love to know your thoughts on this, and possibly some suggestions, too.

31 Mar
2 years ago

mjoc1985 left a reply on Axios POST Submits Twice Creating New Subscription With Laravel Cashier And Stripe

It seems the issue was down to my own lack of knowledge as I've now figured it out.

I've used:


if ($request->wantsJson()){

return URL::to('myurl');

}

I had to use $request->wantsJson() instead of $request->ajax() because it just wasn't detecting that the call was made using an ajax request. I think its something to do with the headers, but anyway this workaround does the job.

Then in the response I can set the window.location = response;

This allows me to state a redirect if made via a normal request too.

mjoc1985 left a reply on Axios POST Submits Twice Creating New Subscription With Laravel Cashier And Stripe

@willvincent yes it looks like it is. I will post my code when I get home this evening.

I'm using @click.prevent on my submit form, then in my stripe conifig I'm doing the usual token related things for stripe, submitting via axis.post to the same route my form is and then I call the submit on my form.

I've done some testing and if I remove the form submit it correctly inserts only one subscription to the database but doesn't redirect to completion page - I could redirect here using window.location.replace and this works.

If I take the axios.post out then the form submits fine and correctly inserts only one record.

It may be me being a noob (only been coding 4 months) but it appears that the form post and the axios.post are both submitting to the same url. The thing that is confusing me is my single charge booking forms using the same code but work as expected.

Should I be pointing the form action and the ajax request to the same route, or should my form action point to a route that isn't for my store() method?

30 Mar
2 years ago

mjoc1985 started a new conversation Axios POST Submits Twice Creating New Subscription With Laravel Cashier And Stripe

Hey guys, I'm really pulling my hair out at the minute. I have a subscription form using Vue 2.0/Laravel 5.4 and axios to post using stripe checkout.

The issue I'm having is when I create a new subscription using laravel cashier in my controller it is duplicating, creating two subscriptions for the user around 5 seconds apart.

I have other similar forms in my app coded the same way (followed Jeffreys stripe course) and they work fine and when charging the customer it only charges once and creates one record in the database.

Apart from some added functionality to validate a coupon code using a get request there is nothing different with this form.

Anyone had any similar issues?

I will post code when I'm at my machine if needed.

17 Nov
2 years ago

mjoc1985 left a reply on Should I Use An Admin Template Such As JoshAdmin?

@pendo @ZetecVan @Nick385 Thanks for your responses, I really do appreciate it. Looking at Vue-Admin and Voyager they seem to be very nice admin templates, which I will have a play around with.

I do agree that the CRUD element is something that saves so much time and is a nice feature these admin templates have.

I think one of the things that worries me a bit is looking at the way some of these admin templates implement code is different to how I would do it, which means if I use one and then start my code work you can see the differences in the code. Maybe I worry about it too much, after all everyone does things differently and it doesn't really matter as long as it gets the job done, I suppose.

Once again, thanks for the responses.

mjoc1985 started a new conversation Should I Use An Admin Template Such As JoshAdmin?

Hey guys, I'm new here as a subscriber but been dabbling in Laravel for a while now. I've decided I'm going to commit to using Laravel for my main business website now that we are upgrading our platform, but I'm in two minds about using an admin template to speed up the process.

Now, I am more than capable of designing and coding an Admin Dashboard and backend myself, albeit slowly. However, I was just wondering if it's a good idea to save some time and use something like JoshAdmin which comes with a load of things already completed, including the layout so would make it a quick start.

I know there is no answer as such, but I would really appreciate some opinions on this.

Personally I like the idea of saving some time and the design is nice, but it comes with way more components than I would ever require, so feels a bit bloated for me. Taking the time to strip out everything I don't want could end up taking just as much time as doing it all myself.

Has anyone here use this template or similar that could give me their thoughts on using them?

Any feedback on this would be greatly appreciated.