afoster009

afoster009

Member Since 1 Year Ago

Experience Points 6,240
Experience Level 2

3,760 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 57
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.

07 Jun
9 months ago

afoster009 started a new conversation Automatically Apply Subscription When User Registers

Hello, i am curious how i would be able to have user set up on a 30 day trial as soon as he signs up? Cant seem to find anything in the docs

30 May
9 months ago

afoster009 left a reply on Get All Team Members Job Sites If Current User Is The Owner Of The Team

@tisuchi

at the moment i just want to write the query which will get all of the Users on the team Job sites. There is a relationship already between Job Sites and users. Also i am using the teams functionality that is baked into Laravel Spark.

I have never used Gates before

29 May
9 months ago

afoster009 started a new conversation Get All Team Job Sites If Current User Is The Owner Of The Team

Hello, i am plugging away at my app and i am required to have team owners to be able to edit / update / delete all of the the team members job sites but i am not sure how to build the proper query. I currently have this query to retrieve the sites for the current user

$jobSites =  DB::table('job_sites')->where('user_id', auth()->id())->get();

but i am not sure how to modify it so i can get the job sites for all of the users on a given team if the current user is the owner of the team. I tried looking through the docs but only see conditional logic for team stuff and nothing seemed obvious to me.

Any suggestions would be extremely helpful!! thanks in advance :)

afoster009 left a reply on Only Allow Subscribed Users To Create Teams

That's what I figured as well, haven't gave it a shot yet though, I'd rather just grab them all in one fell swoop though instead of listing them all out in there :(

afoster009 started a new conversation Only Allow Subscribed Users To Create Teams

Hello, i am wondering how i would block all of the team routes for users who are not subscribed. I assume i could use

Route::get('/paid', ['middleware' => 'subscribed', function () {
    //
}]);

to some extend but it there a way to just grab all of the routes that have to do with teams and block them until a user subscribes to a plan?

Thanks in advance!!

23 May
9 months ago

afoster009 left a reply on Have Check Boxes Checked Or Not Check Based On Database Value True Or False

@lostdreamer_nl

I made those changes, the database changes but the checkbox state just stays checked.

<template>
    <div class="wrapper">
        <div class="card">
            <div class="card-body" v-if="jobSites.length > 0">
                <div v-for="(jobSite, index) in jobSites"  class="media text-muted pt-3 site-container border-bottom border-gray">
                    <div class="col-md-8" @click="initUpdate(index)">
                        <a href="#" @click.prevent.self="test()">
                            <p class=" site-content media-body pb-3 mb-0 small lh-125 ">
                                <strong class="d-block text-gray-dark"><i class="fa fa-home fa-lg active-site"></i>{{jobSite.address}}, {{jobSite.city}}, {{jobSite.province}}</strong>
                            </p>
                        </a>
                    </div>

                    <div class="col-md-4">

                            <input class="box" v-model="jobSite.active"    type="checkbox"  name="active"   @change="updateActiveStatus(jobSite)" >

                    </div>
                </div>
            </div>
        </div>
        <div class="container">
            <div class="modal fade" tabindex="-1" role="dialog" id="update_post_model">
                <div class="modal-dialog" role="document">
                    <div class="modal-content">
                        <div class="modal-header">
                            <h4 class="pull-left modal-title">Update Job site</h4>
                            <button type="button" class="close pull-right" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>

                        </div>
                        <div class="modal-body">

                            <div class="alert alert-danger" v-if="errors.length > 0">
                                <ul>
                                    <li v-for="error in errors">{{ error }}</li>
                                </ul>
                            </div>
                            <div class="form-group">
                                <label>Seeking:</label>
                                <select required id="seeking" class="custom-select " name="seeking" v-model="update_site.seeking">
                                    <option value="1">Material Available</option>
                                    <option value="0">Material Needed</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <label>Material:</label>
                                <select required id="material2"  class="custom-select " name="material" v-model="update_site.material">
                                    <option value="">Select Material</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <label>Loads:</label>
                                <select required id="loads2"  class="custom-select" name="loads" v-model="update_site.loads" >
                                    <option value="">Select Number of Loads</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <label for="date">Date Available:</label>
                                <input placeholder="Please select the date this site is available" required class="form-control" type="date" name="date" id="date"v-model="update_site.date">
                            </div>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                            <button type="button" @click="updatePost()"  class="btn btn-primary">Submit</button>
                        </div>
                    </div><!-- /.modal-content -->
                </div><!-- /.modal-dialog -->
            </div><!-- /.modal -->
        </div>
    </div>


</template>





<script>
    import $ from 'jquery'

    export default {

        data(){

            return {

                errors: [],
                jobSites: [],
                update_site: {},

            }
        },



        mounted()
        {
            this.getSites();



        },



        methods: {

            getSites()
            {
                axios.get('/job-sites')
                    .then(response => {

                        this.jobSites = response.data.job_sites;
                        console.log(this.jobSites);

                    });
            },


            initUpdate(index)
            {
                this.errors = [];
                $("#update_post_model").modal("show");
                this.update_site = this.jobSites[index];
            },


         updatePost()
            {
                axios.patch('/job-sites/' + this.update_site.id, {
                    material: this.update_site.material,
                    loads: this.update_site.loads,
                    seeking: this.update_site.seeking,
                    date: this.update_site.date,

                })
                    .then(response => {

                        $("#update_post_model").modal("hide");

                    })
                    .catch(error => {
                        this.errors = [];
                        if (error.response.data.errors.material) {
                            this.errors.push(error.response.data.errors.material[0]);
                        }

                        if (error.response.data.errors.loads) {
                            this.errors.push(error.response.data.errors.loads[0]);
                        }
                    });
            },
            updateActiveStatus(jobSite)
            {
                
                axios.put('/activate/' + jobSite.id, {

                    active: jobSite.active


                }).then(response => {



                    })
                    .catch(error => {
                        this.errors = [];
                        if (error.response.data.errors.active) {
                            this.errors.push(error.response.data.errors.active[0]);
                        }

                    });
            },
            deletePost(index)
            {
                let conf = confirm("Do you ready want to delete this post?");
                if (conf === true) {

                    axios.delete('/posts/' + this.posts[index].id)
                        .then(response => {

                            this.posts.splice(index, 1);

                        })
                        .catch(error => {

                        });
                }
            }
        }
    }
</script>

Database updates and stuff but the checkbox just stays checked. same issue as i had initially

afoster009 left a reply on Have Check Boxes Checked Or Not Check Based On Database Value True Or False

@lostdreamer_nl

the database still updates as is did before but the checkbox state doesnt stay. it still just remains checked regardless if the database value is 0 or 1

Also, the JSON response is true or false but the value in the database is 0 or 1.

Would this have some sort of impact?

afoster009 left a reply on Have Check Boxes Checked Or Not Check Based On Database Value True Or False

@lostdreamer_nl So i implemented your changes but it is still not working

this is the error i am getting

SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'active' cannot be null (SQL: update `job_sites` set `active` = , `updated_at` = 2018-05-23 17:26:42 where `id` = 2)

assuming that its not picking up the value of the checkbox

here is the updated code with your changes

<template>
    <div class="wrapper">
        <div class="card">
            <div class="card-body" v-if="jobSites.length > 0">
                <div v-for="(jobSite, index) in jobSites"  class="media text-muted pt-3 site-container border-bottom border-gray">
                    <div class="col-md-8" @click="initUpdate(index)">
                        <a href="#" @click.prevent.self="test()">
                            <p class=" site-content media-body pb-3 mb-0 small lh-125 ">
                                <strong class="d-block text-gray-dark"><i class="fa fa-home fa-lg active-site"></i>{{jobSite.address}}, {{jobSite.city}}, {{jobSite.province}}</strong>
                            </p>
                        </a>
                    </div>

                    <div class="col-md-4">

                            <input class="box" v-model="jobSite.active"    type="checkbox"  name="active"   @change="updateActiveStatus(jobSite.id)" >

                    </div>
                </div>
            </div>
        </div>
        <div class="container">
            <div class="modal fade" tabindex="-1" role="dialog" id="update_post_model">
                <div class="modal-dialog" role="document">
                    <div class="modal-content">
                        <div class="modal-header">
                            <h4 class="pull-left modal-title">Update Job site</h4>
                            <button type="button" class="close pull-right" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>

                        </div>
                        <div class="modal-body">

                            <div class="alert alert-danger" v-if="errors.length > 0">
                                <ul>
                                    <li v-for="error in errors">{{ error }}</li>
                                </ul>
                            </div>
                            <div class="form-group">
                                <label>Seeking:</label>
                                <select required id="seeking" class="custom-select " name="seeking" v-model="update_site.seeking">
                                    <option value="1">Material Available</option>
                                    <option value="0">Material Needed</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <label>Material:</label>
                                <select required id="material2"  class="custom-select " name="material" v-model="update_site.material">
                                    <option value="">Select Material</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <label>Loads:</label>
                                <select required id="loads2"  class="custom-select" name="loads" v-model="update_site.loads" >
                                    <option value="">Select Number of Loads</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <label for="date">Date Available:</label>
                                <input placeholder="Please select the date this site is available" required class="form-control" type="date" name="date" id="date"v-model="update_site.date">
                            </div>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                            <button type="button" @click="updatePost()"  class="btn btn-primary">Submit</button>
                        </div>
                    </div><!-- /.modal-content -->
                </div><!-- /.modal-dialog -->
            </div><!-- /.modal -->
        </div>
    </div>


</template>





<script>
    export default {
        data(){

            return {





                errors: [],
                jobSites: [],
                update_site: {},


            }
        },



        mounted()
        {
            this.getSites();



        },



        methods: {

            getSites()
            {
                axios.get('/job-sites')
                    .then(response => {

                        this.jobSites = response.data.job_sites;


                    });
            },


            initUpdate(index)
            {
                this.errors = [];
                $("#update_post_model").modal("show");
                this.update_site = this.jobSites[index];
            },


         updatePost()
            {
                axios.patch('/job-sites/' + this.update_site.id, {
                    material: this.update_site.material,
                    loads: this.update_site.loads,
                    seeking: this.update_site.seeking,
                    date: this.update_site.date,
                    active: this.update_site.active
                })
                    .then(response => {

                        $("#update_post_model").modal("hide");

                    })
                    .catch(error => {
                        this.errors = [];
                        if (error.response.data.errors.material) {
                            this.errors.push(error.response.data.errors.material[0]);
                        }

                        if (error.response.data.errors.loads) {
                            this.errors.push(error.response.data.errors.loads[0]);
                        }
                    });
            },
            updateActiveStatus(jobSite)
            {
                console.log('here');
                axios.patch('/activate/' + jobSite, {

                    active: jobSite.active


                }).then(response => {



                    })
                    .catch(error => {
                        this.errors = [];
                        if (error.response.data.errors.active) {
                            this.errors.push(error.response.data.errors.active[0]);
                        }

                    });
            },
            deletePost(index)
            {
                let conf = confirm("Do you ready want to delete this post?");
                if (conf === true) {

                    axios.delete('/posts/' + this.posts[index].id)
                        .then(response => {

                            this.posts.splice(index, 1);

                        })
                        .catch(error => {

                        });
                }
            }
        }
    }
</script>

any ideas?

19 May
10 months ago

afoster009 left a reply on Have Check Boxes Checked Or Not Check Based On Database Value True Or False

@lostdreamer_nl Won't removing the jobsites object break my update stuff on the other form?

afoster009 left a reply on Update Record In Database Based On Check Box Selection. Laravel + Vue

I figured out how to update the value, but now i am having trouble figuring out how to keep the check box checked if the database value is true.

here is the new code.

<template>
    <div class="wrapper">
        <div class="card">
            <div class="card-body" v-if="jobSites.length > 0">
                <div v-for="(jobSites, index) in jobSites"  class="media text-muted pt-3 site-container border-bottom border-gray">
                    <div class="col-md-8" @click="initUpdate(index)">
                        <a href="#" @click.prevent.self="test()">
                            <p class=" site-content media-body pb-3 mb-0 small lh-125 ">
                                <strong class="d-block text-gray-dark"><i class="fa fa-home fa-lg active-site"></i>{{jobSites.address}}, {{jobSites.city}}, {{jobSites.province}}</strong>
                            </p>
                        </a>
                    </div>

                    <div class="col-md-4">

                            <input class="box" v-model="selected"    type="checkbox"  name="active"   @change="updateActiveStatus(jobSites.id)" >

                    </div>
                </div>
            </div>
        </div>
        <div class="container">
            <div class="modal fade" tabindex="-1" role="dialog" id="update_post_model">
                <div class="modal-dialog" role="document">
                    <div class="modal-content">
                        <div class="modal-header">
                            <h4 class="pull-left modal-title">Update Job site</h4>
                            <button type="button" class="close pull-right" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>

                        </div>
                        <div class="modal-body">

                            <div class="alert alert-danger" v-if="errors.length > 0">
                                <ul>
                                    <li v-for="error in errors">{{ error }}</li>
                                </ul>
                            </div>
                            <div class="form-group">
                                <label>Seeking:</label>
                                <select required id="seeking" class="custom-select " name="seeking" v-model="update_site.seeking">
                                    <option value="1">Material Available</option>
                                    <option value="0">Material Needed</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <label>Material:</label>
                                <select required id="material2"  class="custom-select " name="material" v-model="update_site.material">
                                    <option value="">Select Material</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <label>Loads:</label>
                                <select required id="loads2"  class="custom-select" name="loads" v-model="update_site.loads" >
                                    <option value="">Select Number of Loads</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <label for="date">Date Available:</label>
                                <input placeholder="Please select the date this site is available" required class="form-control" type="date" name="date" id="date"v-model="update_site.date">
                            </div>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                            <button type="button" @click="updatePost()"  class="btn btn-primary">Submit</button>
                        </div>
                    </div><!-- /.modal-content -->
                </div><!-- /.modal-dialog -->
            </div><!-- /.modal -->
        </div>
    </div>


</template>





<script>
    export default {
        data(){

            return {

                isChecked: true,
                jobSites: {
                    material: '',
                    loads: '',
                    seeking: '',
                    date: '',
                    active: '',
                    id: ''
                },



                errors: [],
                jobSites: [],
                update_site: {},


            }
        },



        mounted()
        {
            this.getSites();



        },



        methods: {

            getSites()
            {
                axios.get('/job-sites')
                    .then(response => {

                        this.jobSites = response.data.job_sites;


                    });
            },


            initUpdate(index)
            {
                this.errors = [];
                $("#update_post_model").modal("show");
                this.update_site = this.jobSites[index];
            },


         updatePost()
            {
                axios.patch('/job-sites/' + this.update_site.id, {
                    material: this.update_site.material,
                    loads: this.update_site.loads,
                    seeking: this.update_site.seeking,
                    date: this.update_site.date,
                    active: this.update_site.active
                })
                    .then(response => {

                        $("#update_post_model").modal("hide");

                    })
                    .catch(error => {
                        this.errors = [];
                        if (error.response.data.errors.material) {
                            this.errors.push(error.response.data.errors.material[0]);
                        }

                        if (error.response.data.errors.loads) {
                            this.errors.push(error.response.data.errors.loads[0]);
                        }
                    });
            },
            updateActiveStatus(id)
            {
                console.log('here');
                axios.put('/activate/' + id, {

                    active: this.selected


                }).then(response => {



                    })
                    .catch(error => {
                        this.errors = [];
                        if (error.response.data.errors.active) {
                            this.errors.push(error.response.data.errors.active[0]);
                        }

                    });
            },
            deletePost(index)
            {
                let conf = confirm("Do you ready want to delete this post?");
                if (conf === true) {

                    axios.delete('/posts/' + this.posts[index].id)
                        .then(response => {

                            this.posts.splice(index, 1);

                        })
                        .catch(error => {

                        });
                }
            }
        }
    }
</script>

what i am i missing to keep the check box state persistent?

18 May
10 months ago

afoster009 left a reply on Update Record In Database Based On Check Box Selection. Laravel + Vue

im not sure how to correctly get the value from the check box and reference in axios to patch to the DB

afoster009 left a reply on Update Record In Database Based On Check Box Selection. Laravel + Vue

yeah i had this working before so the server side stuff is fine, i jsut cant get the checkbox value and update the database record with vue

afoster009 left a reply on Update Record In Database Based On Check Box Selection. Laravel + Vue

Like the request is successful but the value remains 0 and does update the DB

afoster009 left a reply on Update Record In Database Based On Check Box Selection. Laravel + Vue

The code is clumsy looking cause ive tried like a million things and havent removed it lol sorry guys. also new to vue

afoster009 started a new conversation Have Check Boxes Checked Or Not Check Based On Database Value True Or False

Hello, i am trying to set a checkbox to checked if the active field in the database is set to true and visa versa. right now i can update the value but the state of the check box doesnt persist it is always just not checked.

Im not sure how to properly do this so any help would be appreciated, here is my code

<template>
    <div class="card">
        <div class="card-body" v-if="jobSites.length > 0">
            <div v-for="(jobSites, index) in jobSites"  class="media text-muted pt-3 site-container border-bottom border-gray">
                <div class="col-md-8">
                    <p class=" site-content media-body pb-3 mb-0 small lh-125 ">
                        <strong class="d-block text-gray-dark"><i class="fa fa-home fa-lg active-site"></i>{{jobSites.address}}, {{jobSites.city}}, {{jobSites.province}}</strong>
                    </p>
                </div>

                <div class="col-md-4">
                    <form class="edit-item" method="POST" :action="/job-sites/ + jobSites.id" >

                        <meta name="csrf-token" content="" />
                        <input class="id_edit" type="hidden" name="id" value="">

                        <input class="box" v-model="activeSite[jobSites.id]"  type="checkbox"  :checked="isChecked" name="active" :value="jobSites.active" @click="initUpdateActiveStatus(index)" @change="updateActiveStatus()" >

                    </form>
                </div>
            </div>
        </div>
    </div>

</template>



<!-- <template>
    <div class="card">
        <div class="card-header">Update Job Site</div>
        <div class="card-body">
            <div class="alert alert-danger" v-if="errors.length > 0">
                <ul>
                    <li v-for="error in errors">{{ error }}</li>
                </ul>
            </div>

            <div class="form-group">
                <label>Title:</label>
                <input type="text" placeholder="Title" class="form-control"
                       v-model="">
            </div>
            <div class="form-group">
                <label for="description">Description:</label>
                <textarea cols="30" rows="5" class="form-control"
                          placeholder="Task Description" v-model=""></textarea>
            </div>
        </div>
        </div>

</template> -->


<script>
    export default {
        data(){
            return {
                isChecked: true,
                jobSites: {
                    material: '',
                    loads: '',
                    seeking: '',
                    date: '',
                    active: '',
                    id: ''
                },
                errors: [],
                jobSites: [],
                update_site: {},
                update_active_status: {},
                activeSite: []

            }
        },
        mounted()
        {
            this.getSites();



        },
        methods: {

            getSites()
            {
                axios.get('/job-sites')
                    .then(response => {

                        this.jobSites = response.data.job_sites;


                    });
            },


            initUpdate(index)
            {
                this.errors = [];
                $("#update_post_model").modal("show");
                this.update_site = this.jobSites[index];
            },

            initUpdateActiveStatus(index){
                this.errors = [];
                this.update_active_status = this.jobSites[index];

            },

          /*  updatePost()
            {
                axios.patch('/posts/' + this.update_site.id, {
                    title: this.update_post.title,
                    description: this.update_site.description,
                })
                    .then(response => {

                        $("#update_post_model").modal("hide");

                    })
                    .catch(error => {
                        this.errors = [];
                        if (error.response.data.errors.title) {
                            this.errors.push(error.response.data.errors.title[0]);
                        }

                        if (error.response.data.errors.description) {
                            this.errors.push(error.response.data.errors.description[0]);
                        }
                    });
            },*/
            updateActiveStatus()
            {

                axios.patch('/job-sites/' + this.update_active_status.id, {
                    active: this.activeSite.toString().split(',').splice(-1).join('')


                }).then(response => {



                    })
                    .catch(error => {
                        this.errors = [];
                        if (error.response.data.errors.active) {
                            this.errors.push(error.response.data.errors.active[0]);
                        }

                    });
            },
            deletePost(index)
            {
                let conf = confirm("Do you ready want to delete this post?");
                if (conf === true) {

                    axios.delete('/posts/' + this.posts[index].id)
                        .then(response => {

                            this.posts.splice(index, 1);

                        })
                        .catch(error => {

                        });
                }
            }
        }
    }
</script>

afoster009 started a new conversation Update Record In Database Based On Check Box Selection. Laravel + Vue

Hello, i am trying to update the active column on my records when a user clicks on a check box.

This should set the value to either 1 or 0. I have it set up and the request goes through ok, but its not updating the value in the database. Any suggestions?

Controller

    public function updateActiveStatus(Request $request, JobSite $jobSite)
    {


        $jobSite->active = $request->active;
        $jobSite->save();
        return response()->json($jobSite);



    }
24 Apr
10 months ago

afoster009 left a reply on Have Multiple Users To One Account

@Snapey do you have an implementation of this you can point me to? for some reason i cant get it to work

23 Apr
10 months ago

afoster009 left a reply on Have Multiple Users To One Account

Also, the admin would be in charge of adding the other user accounts. would the relationship be created through a column like company_id? if so how would that column be populated?

afoster009 left a reply on Have Multiple Users To One Account

@Snapey and how exactly would authentication since multiple user types will be logging into a single company account?

afoster009 left a reply on Have Multiple Users To One Account

This particular app is going to share a single database, where as to my understanding a multi tenant app provides a database for each instance of the app which is not what i am doing.

@Snapey would the relationship basically be company hasMany users and if the role is admin they control the company settings IE billing?

afoster009 started a new conversation Have Multiple Users To One Account

Hello, i am just curious how i would implement a feature where a user subscribes to my site but they have the option to add users to their account with restricted privileges.

The logic is a user subscribes and pays a monthly fee, by default this user would be the admin for the account. The admin now will have the option to add 2 supervisors to his/her account. How exactly would i allow multiple users to sign into this subscribers account?

admin will be the only one to access the billing info and restricted things of that nature while the supervisors can manage other aspects of the subscribers account.

I havent wrote any code for this yet just want to get a few opinions before i hack away at this.

thanks in advance everyone

25 Feb
1 year ago

afoster009 left a reply on Speed Up Query To Large Database Using Eloquent.

I checked this out already and i am getting a bunch of the same query over and over. this one to be exact

[2018-02-25 06:16:57] local.INFO: select top 200 * from [Formula] order by [Formula].[FormID] asc  
[2018-02-25 06:16:57] local.INFO: select * from [Mix] where [Mix].[FormID] in (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [8131,8132,8133,8141,8142,8143,8144,8145,8146,8147,8154,8155,8156,8157,8158,8281,8282,8283,11194,11195,12158,14981,14984,14986,14990,14992,14993,14996,14998,14999,15002,15007,15009,15013,15017,15020,15022,63679,67109,67118,67214,67297,68073,68414,68415,68416,68417,68418,68419,68420,68421,68422,68423,68424,68425,68426,68427,68428,68429,68430,68431,68432,68433,68689,68735,68763,68792,68793,68794,68795,68896,68898,68899,68917,68918,68919,68920,68921,68922,68923,68925,69203,69442,69641,69865,69953,69970,70527,70536,70545,70900,71603,71751,71908,71924,72479,73087,73405,73438,73463,73464,73556,73557,73558,73559,73560,73561,73562,73563,73564,73565,73566,73567,73568,73569,73578,73579,73590,73591,73596,73597,73598,73599,73600,75529,75565,80426,80427,80428,80429,80430,80431,80497,80554,80563,80628,80632,80634,80648,80653,80667,80679,80680,80681,80723,80744,80775,80776,80777,80778,80779,80786,80813,80815,80816,80819,80838,80839,80847,80848,80849,80850,80851,80852,80855,80864,80865,80958,80961,80966,80967,80970,80976,80982,81021,81182,81183,81380,81459,81487,81528,81529,81532,81550,81557,81565,81571,81662,81789,81864,81866,81877,81879,81882,81883,81886,81891,81893,81898,81919] 
[2018-02-25 06:16:58] local.INFO: select * from (select *, row_number() over (order by [Formula].[FormID] asc) as row_num from [Formula]) as temp_table where row_num between 201 and 400  
[2018-02-25 06:16:58] local.INFO: select * from [Mix] where [Mix].[FormID] in (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [82092,82113,82166,82277,82278,82286,82339,82458,82480,82482,82487,82493,82500,82510,82513,82525,82527,82528,82590,83938,84272,84277,84376,84394,84624,84793,85070,85292,85301,85305,85723,85960,86573,87473,87541,87612,87617,87626,87636,87646,87703,87704,87712,87742,87749,87829,87865,88145,88399,88479,88974,89002,89404,89421,89422,89551,89613,90276,90354,90384,90636,91119,91163,91164,91313,91402,91488,91561,92116,92135,92615,93059,93082,93083,93092,93094,93095,93096,93097,93098,93099,93146,93148,93149,93150,93151,93152,93153,93154,93155,93156,93158,93159,93160,93161,93162,93163,93164,93165,93166,93187,93198,93210,93228,93229,93230,93233,93237,93246,93249,93250,93252,93256,93264,93265,93284,93286,93287,93291,93294,93301,93304,93305,93307,93314,93315,93327,93334,93335,93336,93370,93373,93374,93375,93461,93463,93465,93516,94092,94682,95765,95767,95768,95769,95770,95772,95773,95774,95775,95776,95778,95779,95780,95781,95782,95783,95784,95785,95786,95789,95790,95791,95792,95794,95795,95796,95797,95798,95799,95800,95801,95802,95803,95804,95806,95812,95813,95815,95816,95817,95818,95819,95820,95821,95822,95824,95825,95826,95827,95828,95829,95830,95831,95832,95833,95834,95835,95836,95838,95839] 
[2018-02-25 06:16:59] local.INFO: select * from (select *, row_number() over (order by [Formula].[FormID] asc) as row_num from [Formula]) as temp_table where row_num between 401 and 600  
[2018-02-25 06:17:00] local.INFO: select * from [Mix] where [Mix].[FormID] in (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [95840,95841,95842,95843,95844,95845,95846,95847,95848,95849,95850,95851,95853,95854,95855,95856,95857,95858,95859,95861,95862,95863,95864,95865,95866,95867,95868,95869,95870,95871,95872,95874,95875,95876,95879,95880,95881,95883,95884,95885,95887,95888,95889,95890,95891,95892,95893,95894,95895,95896,95897,95898,95899,95900,95901,95902,95903,95904,95905,95906,95909,95910,95911,95913,95915,95916,95920,95922,95923,95924,95926,95927,95928,95929,95930,95931,95932,95933,95934,95935,95936,95937,95938,95939,95940,95941,95942,95943,95944,95946,95947,95948,95949,95951,95953,95954,95955,95956,95957,95959,95960,95961,95962,95963,95965,95966,95967,95969,95970,95971,95972,95973,95974,95977,95978,95979,95980,95983,95985,95986,95987,95988,95989,95990,95991,95992,95993,95995,95996,95997,95998,95999,96004,96006,96007,96008,96009,96011,96012,96013,96014,96015,96016,96018,96019,96020,96021,96022,96023,96024,96025,96026,96027,96028,96029,96030,96031,96032,96033,96034,96035,96036,96037,96038,96039,96040,96041,96042,96043,96044,96045,96046,96047,96048,96049,96050,96051,96052,96053,96054,96055,96056,96057,96058,96059,96060,96061,96062,96063,96064,96065,96066,96067,96068,96069,96070,96071,96072,96073,96074] 
[2018-02-25 06:17:00] local.INFO: select * from (select *, row_number() over (order by [Formula].[FormID] asc) as row_num from [Formula]) as temp_table where row_num between 601 and 800  

using the chunk method.

afoster009 left a reply on Speed Up Query To Large Database Using Eloquent.

Although it technically works its still not the solution i am looking for. Having it paged like that just causes me more work in the client side :( any other suggestions or is this my best bet and i should just role with it

afoster009 left a reply on Speed Up Query To Large Database Using Eloquent.

Also to humor you this is the error when i slap paginate on the end

Tried to bind parameter number 2101. SQL Server supports a maximum of 2100 parameters

afoster009 left a reply on Speed Up Query To Large Database Using Eloquent.

I am not displaying the data in a view within laravel but rather i am building a REST api that will be used by another application

afoster009 started a new conversation Speed Up Query To Large Database Using Eloquent.

Hello there, i am trying to fetch over 50k records from my DB using eloquent but it just takes forever, and in all honestly 50k records isn't even that big of a deal.

Right now i am trying to use the built in chunk() method but that doesn't seem to help, nor do i really understand what its doing.

A little background on the setup i have here.

I have 2 models.

Formula Model:

class Formula extends Model
{
    //

    protected $table = 'Formula';
    protected $primaryKey = 'FormID';
    protected $hidden = ['SSMA_TimeStamp'];
    public function mix()
    {
        return $this->hasMany('App\Mix', 'FormID');
    }



}

Mix Model:

class Mix extends Model
{
    //
    protected $table = 'Mix';
    protected $primaryKey = 'FormID';
    protected $hidden = ['SSMA_TimeStamp'];
    public function formula(){
        return $this->belongsTo('App\Formula', 'FormID' )->select();
    }
}

Basically i am trying to grab all formulas and their respective mixes through an api call to this route.

Route::get('/formulas', function(){


    App\Formula::with('Mix')->chunk(200, function($formulas){
       foreach ($formulas as $formula){
          return $formula;
       }
    });


});

as it stands i get no JSON in my browser but when i var_dump($formula) i see some data.

So i must be doing something wrong here, is anyone able to point me in the right direction?

Also if more information is needed let me know.

Thanks in advance!