futurefuture

futurefuture

Member Since 3 Years Ago

Experience Points
44,540
Total
Experience

460 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
430
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start-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-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-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist 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 9
44,540 XP
Sep
02
1 month ago
Activity icon

Replied to Optimize Relationship Query

Ah thanks so much for the reply...I guess I just didn't realize it was so important.

I'll give it a shot now :)

Aug
31
1 month ago
Activity icon

Started a new conversation Optimize Relationship Query

Hey there,

Any help on this would be greatly appreciated.

I have 3 tables.

  1. inventory
  2. product
  3. inventory_product

They all have their associated models and the inventory and product table are related through a belongsToMany relationship through the inventory_product table. On this pivot table, there is an additional pivot column for quantity.

Thus, a product can exists with different quantities at different inventories.

I am using the inventory to query the products available in that inventory. My problem is that I am running into very slow queries...about 3 seconds are so, especially when adding filtering parameters. Below is my code. Any help on this would be awesome.

I have no created any DB indexes or foreign keys yet...was thinking of using that as a last resort.

Thanks

Inventory.php
public function productsAll()
    {
        return $this
            ->belongsToMany(NewProduct::class, 'inventory_product', 'inventory_id', 'product_id')
            ->withPivot('quantity');
    }
InventoryProductController.php
public function index(Request $request, Inventory $inventory)
    {
        $allProducts       = $inventory
            ->productsAll()
            ->whereIn('category_id', $categoryIds)
            ->with(['tags', 'inventories', 'incentives', 'reviews'])
            ->select('new_products.*', 'quantity')
            ->get();

       

        return new ProductCollection($allProducts);
    }
Jul
12
3 months ago
Activity icon

Replied to JSON API Spec

Thanks for this!

I agree, it's good to tell customers - but internally, I feel like it's a lot....I'm kind of too deep in the weeds to turn back right now anyway, but I appreciate seeing other people out there working with it as well :)

Jul
08
3 months ago
Activity icon

Started a new conversation JSON API Spec

Just curious, is anyone using this?

And if so, is anyone using it in full?

I made the switch recently, and as far as I can tell, I have yet to see it in actually adopted by any large companies.... I thought I was making a good choice on this, but now am starting to get cold feet.

Thoughts?

Jun
28
3 months ago
Activity icon

Replied to Casting In A Resource

Thanks for the quick response on that - good to know that I'm not just doing something wrong :)

So basically in this sense, cast works good for input into DB, and Resource I still have to manually json_decode everything. I'm fine with that.

Thank again!

Activity icon

Started a new conversation Casting In A Resource

Hello,

I've cast a column of JSON data as an array on a model of mine, and works great - just not in the resource.

I still need to use json_decode($data) in the resource - any ideas why, or a way around this?

Thanks!

Jun
22
3 months ago
Activity icon

Replied to Laravel Testing

What's the error that you are getting?

Activity icon

Started a new conversation Merging MySQL

Hello,

Looks like last week I I wrote over some data locally that I'd like to fix. I wrote over about 3 thousand records on table that had primary keys...

So, locally I am missing records 126000 - 129000

I have the missing data on a backup, but am looking to merge it back in...Any thoughts on this?

The best way I can think of is the export the missing records on the backup into a CSV file, and from there, reimport into the specific table on the local DB while ignoring the previous primary keys.

Any help would be greatly appreciated. Thanks!

Activity icon

Replied to Versioning

Thanks, just wanted to make sure I wasn't way off on this...Thanks for all the suggestions!

Jun
20
3 months ago
Activity icon

Replied to Versioning

Thanks for the responses!

Yea, I am using git...sorry, maybe I'm not clear or misunderstanding.

I can't just have the separate versions live in git, as they need to be live still. I have iOS applications consuming older versions of the api as well as current versions.

For instance, if an iOS app user decides not to update their app, they will be using api.example.com/v1/users, while if they do, they will be using api.example.com/v2/users

Is there some GIT best practice to deal with this?

Activity icon

Started a new conversation Versioning

Hey there,

Been versioning our software pretty rapidly in the past 2 years and I've found the best way to do this is to keep everything in folders...ie

/routes/v4/api.php app/http/controllers/v2/usercontroller.php

I've been doing this with services, resources etc. basically everything except models.

This is obviously making my codebase larger and larger but it seems like the best/easiest way to organize versioning..obviously there is some (a lot) of duplication, but it keeps things cleaner on our end.

is this bad practice? is there maybe another better way of separating versioned software?

Jun
19
3 months ago
Activity icon

Replied to Serverside Breadcrumbs Or Clients Side

Thanks for the tips!

I am running a Vue app, but it is not SPA - so a server side package/implementation would definitely be of the most help.

Thanks so much!

Jun
18
3 months ago
Activity icon

Started a new conversation Serverside Breadcrumbs Or Clients Side

Hey there,

Looking to setup some breadcrumb navigation for a site that I'm working on - just curious whether or not anyone has any input on whether or not I should calculate these server side, or client side based on the url?

Any help would be greatly appreciated.

Thanks!

Nov
08
11 months ago
Activity icon

Replied to Add Items To Beginning Of Collection

@cronix yea sorry, should have mentioned that. $t is maintained internally, but paramater binding is def a good idea here. thanks for the heads up!

Activity icon

Replied to Add Items To Beginning Of Collection

For anyway running into this same issue, i got is working using the following, where $t is the array of product Ids that I want to take precedence, and is variable.

$t = '28,1';

$products = Product::orderByRaw('FIELD(products.id,' . $t . ') desc')->paginate();

Thanks for all the help and hope this helps anyone in need :)

Nov
07
11 months ago
Activity icon

Replied to Add Items To Beginning Of Collection

@tykus

I have 13,000 products but for simplicity, let's say I have 20 products and 4 separate rankings for them depending on url.

$products = [1,2,3,4,5,....]

/wine => product ranking would go [2,3,4,5,9....] /whats-new => product ranking would go [4,5,2,6,7,2...] /whats-hot => product ranking would go [9,6,5,4,3,2....]

etc.

Does that make more sense?

Activity icon

Replied to Add Items To Beginning Of Collection

@SNAPEY - Right, but if i want the ranking to be different in both...

so 1 in /wine and 3 in /new-items...and maybe 7 in /what's-hot

That's why I was thinking an individual array of top ranked items for each query that could be sorted against...

Pretty specific, I know :/

Activity icon

Replied to Add Items To Beginning Of Collection

@TYKUS - Thanks for that - but the issue I have with that is that the same products will be returned in different orders depending on the query...

for instance /wine and /new-items would both be querying the same product table but would have individual indexes that should be first..

that's why i need an external index or array of $productsAtBeginning for each query.

not sure if that makes sense?

Activity icon

Replied to Add Items To Beginning Of Collection

@jlrdw like a raw query?

aren't all eloquent queries returned as collections?

Activity icon

Started a new conversation Add Items To Beginning Of Collection

Hey there,

Lets say I have:

$productsAtBeginning = [1,3,6565,8,541]
$product = Product::paginate();

Does anyone know of an easy way to get the entire paginated query with the ids in the array at the beginning?

Thanks!

Activity icon

Replied to Stupid Question - JSON_ENCODE

@cronix the reason I am doing it all online is because I want other people on the team to be able to easily edit it.

I guess I could just create a form input that would decode and encode upon save.

just found it strange that there is not an online tool for this.

Thanks!

Activity icon

Started a new conversation Stupid Question - JSON_ENCODE

Hey there, I have a JSON object saved as a string in DB and it is encoded and thus properly escaped.

If i need to change one value within the JSON object, i am currently pulling the whole thing out, running through an online JSON_DECODER and then re-shrinking and re-saving in the DB.

I know this is not optimal for now, but I'm still in DEV in this just seems easiest.

My question is:

Is there a simple online tool anywhere that will re json_encode the data properly escaped?

I haven't found anything yet to do this. What I've been doing is viewing the json_encoded data in the browser and copy and pasting back into the DB.

Secondly, is it actually much better to be escaped?

Thanks

Oct
24
11 months ago
Activity icon

Replied to Long Query

@jlrdw

Yea, 3.5 seconds.

Right, I have nightly reports running on a few queries as well, but these are for APIs being consumed real-time so query time is definitely a factor.

Activity icon

Replied to Long Query

FYI:

been doing this and it's been working much better...down to about 793ms.

$productIds = NewInventory::find($inventoryId)
                                    ->products
                                    ->pluck('id');

        $products = NewProduct::withAllTags($filters)
                        ->where('category_id', $categoryId)
                        ->whereIn('id', $productIds)
                        ->paginate();           
Activity icon

Replied to Long Query

@Dalma

Thanks for taking the time to respond. Yea, I have tested without the 3rd party package and the response time is much lower - about 230ms generally.

Looks like all the integers are indexed as well yea.

My main reason for even using this package and not creating my own was this ::withAllTags static method on the model that is created...I was having trouble creating something similar myself.

Activity icon

Started a new conversation Long Query

Hey!

Was looking for some help on this possibly. I have a query that is averagin about 3.5s and was looking to get it down.

I am using a 3rd party tagging package: https://github.com/rtconner/laravel-tagging

It's great so far, but this is the query that is taking a long time...was wondering if anyone knew a way of optimizing it...

$filters = ['filter'];
$categoryId = 1;
$inventoryId = 1;

$products = NewProduct::withAllTags($filters)
                        ->where('category_id', $categoryId)
                        ->whereHas('inventories', function ($query) use ($inventoryId) {
                            $query->where('inventory_id', '=', $inventoryId);
                        })
                        ->paginate();

Any help would be greatly appreciated. Thanks!

Oct
09
1 year ago
Activity icon

Replied to Load Balancer Passport Keys

@D9705996 and @fideloper Thanks so much for the insight.

Good to know I wasn't way off the beaten path with my thoughts on this.

For the time being, I've just copied the keys over to the second server. This is just going to be temporary until I ultimately most likely with the s3 like you suggested @fideloper.

So you have the entire .env file in s3? That's smart, as that would save me the trouble of having to update 2 or more .env files in general as well when making changes.

Pretty cool btw that you got back to me on this @fideloper. Was using your Scaling On Forge lessons to guide me through and entire overhaul of my server setup.

It was absolutely great. Super informative, good pace and interesting. I'll probably be purchasing your Scaling Laravel course in the near future so thanks for that :)

Oct
08
1 year ago
Activity icon

Started a new conversation Load Balancer Passport Keys

Hey guys,

Was wondering if anyone had a clean solution for managing synced passport keys across 2 separate servers beneath a load balancer.

The two options that I can think of are:

  1. copy auth keys from server 1 into server 2
  2. post keys on S3 or something similar and link vie the .env file on each server

Thoughts?

Thanks in advance!

Jul
12
1 year ago
Activity icon

Started a new conversation Change Increment Schema To Not Auto Increment

Hello,

I have an initial migration that has been set with a schema of increment.

Does anyone know if there is an easy way to change increment into a simple integer schema value with a new migration??

Thanks!

Activity icon

Started a new conversation Running Command Through Scheduler

Hey there - running into kind of a weird problem.

I have a job scheduled to run every night and email me the output - it does work in the sense that it at least tries, but in the emailOutput, I get an exception and the command doesn't continue..

However, when I run the same command on the server manually, it actually does finish the job. And I don't see any exceptions.

The exceptions I'm getting in the emailOutput are 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry' btw.

Has anyone else run into this kind of behaviour and is there a way to fix it/an explanation?

Thanks!

May
30
1 year ago
Activity icon

Replied to Struggling With Vuex Computed Properties

@ejdelmonico As an update, I could still only ever get the computed property to wait for the action and console.log the proper value after using this:

actions.js:

const actions = {
    getUser({
        commit
    }, data) {
        return new Promise((resolve, reject) => {
            axios({
                method : 'get',
                url    : '/api/v2/user',
                headers: {
                    'Authorization': 'Bearer ' + data.token
                }
            })
                .then(response => {
                    commit('setUser', response.data.data);
                    commit('setAddress', response.data.data.address);
                    commit('setUnit', response.data.data.unit);
                    commit('setInstructions', response.data.data.instructions);
                    resolve();
                })
                .catch(error => {
                    console.log(error);
                });
        });
    },
}

index.vue:

created() {
    this.$store.dispatch('getUser', {
            token: vm.$cookie.get('token')
        }).then(() => console.log(vm.user));
},
computed: {
    user() {
        return this.$store.state.user;
    }
}

It doesn't really make send to me though...not wrapping axios in a promise, it doesn't work...but isn't axios supposed to return a promise?

Also, I want to user the computed user() in other components of my app - would this mean I would have to dispatch from separate components? And wouldn't that negate the purpose of Vuex?

Thanks!

May
17
1 year ago
Activity icon

Replied to Struggling With Vuex Computed Properties

@ejdelmonico Thanks for taking a look at that - This is all very valuable insight.

One thing I am going to try today (hopefully it works) is passing my user object into the actual #app and passing it down as a prop.

If that doesn't work, I'm going to fiddle around with some async/await and sometimeouts

Thanks for the help!

May
16
1 year ago
Activity icon

Replied to Struggling With Vuex Computed Properties

First off, thanks for even trying to help me out here. very much appreciated.

yea for sure. my index, actions and mutations are below.

My main problem is that all my computed properties are only loading initial states and not their properties after the api has been dispatched. it's driving me nuts haha

index.js:

import Vue from 'vue';
import Vuex from 'vuex';
import actions from './actions';
import mutations from './mutations';

Vue.use(Vuex);

const state = {
        test        : null,
        user        : null,
        address     : null,
        unit        : null,
        instructions: null,
        environment : null,
        cart        : {

        },
        addtocart            : false,
        cartIsOpen           : false,
        addressIsOpen        : false,
        paymentIsOpen        : false,
        menuIsOpen           : false,
        searchIsOpen         : false,
        favouritesIsOpen     : false,
        checkoutdetailsIsOpen: false,
        isLoading            : false,
        isLoadingPage        : false
    },
    getters = {
        userId(state) {
            return state.user;
        },
        itemsCount(state) {
            if (state.cart.hasOwnProperty('content')) {
                return state.cart.content.length;
            }
            else {
                return 0;
            }
        },
        cartItems(state) {
            if (state.cart.hasOwnProperty('content')) {
                return state.cart.content;
            }
            else {
                return [

                ];
            }
        },
        stripeKey(state) {
            if (state.environment === 'production') {
                return ******;
            }
            else {
                return *******;
            }
        }
    },
    store = new Vuex.Store({
        state,
        getters,
        actions,
        mutations
    });

export default store;

mutations.js:

const mutations = {
    setUser: function(state, user) {
        state.user = user;
    },
    setAddress: function(state, address) {
        state.address = address;
    },
    unsetAddress: function(state) {
        state.address = null;
    },
    setUnit: function(state, unit) {
        state.unit = unit;
    },
    setInstructions: function(state, instructions) {
        state.instructions = instructions;
    },
    setEnv: function(state, env) {
        state.environment = env;
    },
    setLoading: function(state) {
        state.isLoading = !state.isLoading;
    },
    setCart: function(state, cart) {
        state.cart = cart;
    },
    updateCartDiscount: function(state, discount){
        state.cart.discount = discount;
        state.cart.total -= discount;
    },
    updateCartItem: function(state, payload) {
        state.cart.count = 0;
        state.cart.subtotal = 0;
        state.cart.tax = 0;
        state.cart.delivery = 9.99;
        var package_size = 0;
        var expensive_item = false;
        var hasBundle = false;

        state.cart.content.forEach(element => {
            if (element.type === 'product') {
                if (element.rowId === payload.rowId) {
                    element.qty = payload.qty;
                }

                state.cart.count += element.qty;
                state.cart.subtotal += element.qty * element.runner_price;
                state.cart.tax += element.qty * element.markup * 0.13;

                if (element.runner_price > 100) {
                    expensive_item = true;
                }

                if (element.package.split('mL')[0].indexOf('x') > -1) {
                    package_size += element.qty * parseInt(parseFloat((element.package.split('mL')[0].split('x')[0]).replace(/,/g, '')) * element.package.split('mL')[0].split('x')[1]);
                }
                else {
                    package_size += element.qty * parseFloat((element.package.split('mL')[0].split('x')[0]).replace(/,/g, ''));
                }
            }
            else {
                hasBundle = true;
                if (element.rowId === payload.rowId) {
                    element.qty = payload.qty;
                }
                state.cart.count += element.qty;
                state.cart.subtotal += element.qty * element.runner_price;
                state.cart.tax += element.qty * element.markup * 0.13;
            }
        });

        if (hasBundle) {
            state.cart.delivery = 9.99;
        }
        else if (package_size > 7500) {
            state.cart.delivery = 14.99;
        }
        state.cart.tax += state.cart.delivery * 0.13;
        state.cart.total = state.cart.subtotal + state.cart.tax - state.cart.discount + state.cart.delivery;
    },
    showAddtocart: function(state) {
        state.addtocart = true;
    },
    hideAddtocart: function(state) {
        state.addtocart = false;
    },
    toggleCart: function(state, status) {
        state.cartIsOpen = status;
    },
    togglePayment: function(state, status) {
        state.paymentIsOpen = status;
    },
    toggleCheckoutDetails: function(state, status) {
        state.checkoutdetailsIsOpen = status;
    },
    toggleAddress: function(state, status) {
        state.addressIsOpen = status;
    },
    toggleMenu: function(state, status) {
        state.menuIsOpen = status;
    },
    toggleSearch: function(state, status) {
        state.searchIsOpen = status;
    },
    toggleFavourites: function(state, status) {
        state.favouritesIsOpen = status;
    },
    toggleIsLoadingPage: function(state, status) {
        state.isLoadingPage = status;
    }
};

export default mutations;

actions.js:

import LogRocket from 'logrocket';

const actions = {
    getUser(context, data) {
        axios({
            method : 'get',
            url    : '/api/v2/user',
            headers: {
                'Authorization': 'Bearer ' + data.token
            }
        })
            .then(response => {
                context.commit('setUser', response.data.data);
                context.commit('setAddress', response.data.data.address);
                context.commit('setUnit', response.data.data.unit);
                context.commit('setInstructions', response.data.data.instructions);

                LogRocket.identify(response.data.data.id, {
                    name : response.data.data.first_name + ' ' + response.data.data.last_name,
                    email: response.data.data.email
                });
            })
            .catch(error => {
                console.log(error);
            });
    },
    getAuth(context, data) {
        axios({
            method: 'get',
            url   : '/api/v1/user'
        })
            .then(response => {
                context.commit('setUser', response.data);
                context.commit('setAddress', response.data.address);
                context.commit('setUnit', response.data.unit);
                context.commit('setInstructions', response.data.instructions);
            })
            .catch(error => {
                console.log(error);
            });
    },
    logout(context, data) {
        var token = data.token;

        axios({
            method : 'get',
            url    : '/api/v2/logout',
            headers: {
                'Authorization': 'Bearer ' + token
            }
        })
            .then(response => {
                location.href='/';
            })
            .catch(error => {
                console.log(error);
            });
    },
    getAppEnvironment(context) {
        axios.get('/api/v2/env')
            .then(response => {
                context.commit('setEnv', response.data.data.environment);
            })
            .catch(function(error) {
                console.log(error);
            });
    },
    getCart(context, data) {
        var token = data.token;

        axios({
            method : 'get',
            url    : '/api/v2/cart?version=2.07',
            headers: {
                'Authorization': 'Bearer ' + token
            }
        })
            .then(response => {
                context.commit('setCart', response.data.data);
            })
            .catch(error => {
                console.log(error);
            });
    }
};

export default actions;
Activity icon

Replied to Struggling With Vuex Computed Properties

@ejdelmonico Thanks for responding - I did try mapping once with the same results.

Does mapping do anything beyond organizing computed state better?

I keep reading everywhere that using an action allows for asynchronous state.

Yet, the only way I can get any of my computed properties that are coming from my api is if i set a timeout for 3 seconds on it.

I'm sure I must be doing something simple wrong but will definitely try out mapping again.

May
15
1 year ago
Activity icon

Started a new conversation Struggling With Vuex Computed Properties

Hey there - I'm having one hell of a time getting this working.

Basically anytime I try to access my computed properties within my code, I only get initial state of null.

Vuex dev tools show the state to exist, and when setting a timeout on the computed property, it does work.

Also, if I use {{ user }} within template, it reads.

Any help would be greatly appreciated. Here is my code:

index.js:

const state = {
        user : null,
}

mutations.js:

const mutations = {
    setUser: function(state, user) {
        state.user = user;
    }
}

actions.js

getUser(context, data) {

        axios({
            method : 'get',
            url    : '/api/v2/user',
            headers: {
                'Authorization': 'Bearer ' + data.token
            }
        })
            .then(response => {
                context.commit('setUser', response.data.data);
            })
            .catch(error => {
                console.log(error);
            });
    },

index.vue:

computed() {
    user() {
        return this.$store.state.user;
    }
}   
methods: {
getUser() {
    this.$store.dispatch('getUser', {
        token: vm.$cookie.get('token')
    });
}
                
May
09
1 year ago
Activity icon

Replied to Single Object In Collection To Array[0] Response

I figured it out I think. For anyone else that needs to know.

So simple.

return $products->all();

got it from this post: https://stackoverflow.com/questions/19648722/eloquent-orm-single-item-collection-return-as-array

Activity icon

Replied to Single Object In Collection To Array[0] Response

Yea, of course. Thanks. Here is the test below:

$response->assertJsonStructure([
    'data' => [
        'products' => [

        ]
    ]
]);

That's . dumbed down version, but basically I'm looking to create an array, even if there is only one object in the collection

May
08
1 year ago
Activity icon

Started a new conversation Single Object In Collection To Array[0] Response

Hey guys, I seem to keep running into this problem. Maybe someone can help me out.

Let's say I have and order of x amount of unknown products. I write a test to assert that I will have an array of products in the order.

This is fine for mutiple products, but when converting my collection of 1 product, it doesn't cast into an array...

What I've been doing is this:

$productArray = [];

foreach ($products as $product) {
    array_push($productArray, $products);
}

$order->products = $productArray;

This seems to work, but is there a better, more Eloquent way of doing this?

Hopefully that made sense.

Thanks!!

May
04
1 year ago
Activity icon

Replied to Trouble With Vuex && Computed

@wilk_randall ha, sorry I wrote that out too quickly and forget to define user.

Hmm, yea i just tried this and I seem to have access it. Thanks, I think I was just losing my mind for a second :)

Activity icon

Started a new conversation Trouble With Vuex && Computed

Hey there,

Was wondering if anyone could shed a little light on this for me.

I understand that using a computed property can allow it to be used in a Vue template..

But what if I want to use directly in the code...For instance:

computed() {
    return this.$store.state.user
}

mounted() {
    if (user) {

        \ do something
    }
}

It seems like I don't have access to user on mounted programatically. Thoughts?

Thanks!

Activity icon

Replied to Best Place To Store Stripe Keys

Thanks @ejdelmonico !

I checked out that package - what I ended up doing was just setting state in vuex.

Thanks anyway!

Apr
27
1 year ago
Activity icon

Started a new conversation Best Place To Store Stripe Keys

Hey there,

Looking for some advice here. I'm using Stripe on my website and using Vue for everything front end.

I'm having trouble figuring out where to store the keys for live and development.

Basically, right now, inside of all components needing Stripe, I have making a call to the server via API and determining the environment.

Then, from there, depengin on the environment, I am selecting which key to use.

This seems messy to me though....I am using VUEX, but not for this. Would anyone recommend storing this in state and grabbing as a computed property?

Thanks in advance!

Nov
10
1 year ago
Activity icon

Replied to JSON Response Format Help

Thanks for the responses guys!

Nov
09
1 year ago
Activity icon

Started a new conversation JSON Response Format Help

Hey guys,

Looking for a little help/ideas on proper output for JSON responses using Laravel. This is what I am doing:

For any response containing data:

'data': {
    'key': 'value'
}

For errors:

'errors': {
    'error': message
}

And for status changes:

'message': 'updated successfully'

Does this make sense, or is there a better standard that I should be using? Thanks!

Nov
04
1 year ago
Activity icon

Replied to API Resource Queries

Thanks bobby!

Yea, realized immediately after that #2 was just a dumb mistake on my part.

As for using/not using the JSON:API spec, I know that it's a matter of opinion...I guess Laravel just wanted to leave it open..Any recommendations? I'm just using the Laravel data wrap right now and it seems to be working...

Best,

Nov
03
1 year ago
Activity icon

Started a new conversation API Resource Queries

Hey there,

Was looking for a little help using Laravel's resource builder. 2 questions actually.

  1. Laravel's API Resource does not seem to be using JSON:API spec. Should I be creating my own wrapper to follow this spec, or is it not really a big deal?

  2. Trying to use

$this->cartStarters = CartStarterResource::collection(CartStarter::where('active', 1));

It doesn't seem to recognize the where method. Any ideas on how I can make this work?

Thanks!

Oct
24
1 year ago
Activity icon

Replied to Order Confirmation Hash

Thanks for the insightful response - Yea, I think I'm just going to use the unique ID of that actual order.

But you're saying that I don't need to actually save the hash in a separate column? That I could build an en/decoder to parse the unique ID into a longer hash?

Do you know of any package available for this type of thing by any chance?

Best,

Oct
21
1 year ago
Activity icon

Started a new conversation Order Confirmation Hash

Howdy,

Was looking for some advice on an order confirmation url.

Currently, I am just using a /confirmation once a user confirms an order. It basically just grabs most recent order in the orders table and returns the data.

I feel like this is a very bad idea though....Should I be creating a hash for each order and having a unique url for each order?

And if so, would bcrypt be sufficient for this?

Any help would be greatly appreciated. Thanks in advance! :)

Mar
25
2 years ago
Activity icon

Replied to Bitbucket Token Error

Hey @jeremyt,

Thanks for the response. I ended up figuring it out.

Not really sure why i initially needed to refresh the token, but turns out that I was logged into a different Bitbucket account when I refresh it.

After finally realizing this, logging into the proper account and refreshing the token worked.

Mar
23
2 years ago
Activity icon

Started a new conversation Bitbucket Token Error

Hey guys, Just tried to run a deploy to my server through Forge and got this error:

Whoops! There were some problems with your input.

We were unable to deploy your site because your Bitbucket token is invalid for this repository or has expired. Please refresh the token in your Forge account profile's "Authentication" tab.

I haven't had any issues in the past and I haven't changed my repo name or anything like that.

I tried refreshing the token like the message suggest and am still getting the error.... Anyone else have this issue?