Gabotronix

Gabotronix

Member Since 1 Year Ago

Experience Points
21,780
Total
Experience

3,220 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
45
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 5
21,780 XP
14 Sep
1 week ago

Gabotronix started a new conversation Review Model Relationship With Multiple Tables?

Hi everybody, My app has many models, particularly any logged in user can give feedback and create a review, they can create a plain Review, a DiscountReview and PostReview, this three models are my review models. One DiscountReview belongs to a Discount, one Discount can have many DiscountReviews ... so after some time I just noticed that since a review will always have the same attributes (title, body, rating ... ) maybe I should write a single Review Model and attach it to other Models, a Post, a Discount and other Models can have a Review associated to them or not.

So my question is how can I set up a relationship like this with laravel?

19 Aug
1 month ago

Gabotronix started a new conversation Laravel For Backend/API For Nativescript-vue App?

Hi everybody, I have been reading a lot about nativescript-vue recently for developing native apps on mobile while using vue's single file components and familiar syntax and structure, however I haven't find anything about connecting my laravel backend to my nativescript-vue application? Basically I want to manage auth and API endpoints with laravel and have vuex modules to manage application state and UI in mobile, are there any examples on how to connect a nativescript-vue app to consume laravel backend services?

09 Aug
1 month ago

Gabotronix started a new conversation Access Vuex State Dynamically With Bracket Notation In Template

Hi everybody, I have an v-for in my template and a piece of state which I want to dynamically access using bracket notation (this works for actions so it should work for state afaik) but nothing is getting rendered, this is my template:

<template v-if="field.element == 'select'">
    <select class="modal_input_select" v-model="formData[field.id]">
        <option v-for="result in $store.state[field.module][field.results]" :key="result.id" 
           :value="result.id">{{ result.title }}</option>
        </select>
</template> 

And this is my schema I use to build my modal:

createSchema:
    {
        title: 'Nueva publicación', description:'',
        formData: { image: '', title: '', body:'' },
        fields: 
        [
            { id: 'image', label: 'Imagen', element: 'image', type: 'image' },
            { id: 'title', label: 'Titulo', element: 'input', type: 'text' },
            { id: 'body', label: 'Contenido', element: 'editor', type: 'html' },
            { id: 'postcategory', label: 'Categoría', element: 'select', type: 'select', module: 'PostCategories', results: 'postCategories'},
        ],
        buttons:
        [
            { text: 'Guardar', background: 'var(--blue_boot)', validate: true, module: 'Posts', action: 'create' },
            { text: 'Volver', background: 'var(--grey_boot)', validate: false, module: 'AdminPanel', action: 'hideModal' },
        ],
        mounted:
        [
            { module: 'PostCategories', action: 'all' },
        ]
    },
06 Jul
2 months ago

Gabotronix started a new conversation Javascript Array.slice Not Working As Intended

Hi everybody, I have four image sliders and an array of images, I'm using four computed properties to have four arrays and pass these as props to my image sliders, however only the first slider is displaying correctly, other three sliders aren't showing images at all, what am I doing wrong?

After checking vue dev tools second,third and fourth array are empty...

<template>
<section class="SLIDERcontainer9_maincontainer shadow">
    <div style="width:50%; height:50%;  display:flex; border:1px solid var(--web_secondary_color);">
        <slider-container-13 :sliderinterval="5000" :slideritems="firstItems"></slider-container-13>
    </div>
    <div style="width:50%; height:50%;  display:flex; border:1px solid var(--web_secondary_color);">
        <slider-container-13 :sliderinterval="6000" :slideritems="secondItems"></slider-container-13>
    </div>
    <div style="width:50%; height:50%;  display:flex; border:1px solid var(--web_secondary_color);">
        <slider-container-13 :sliderinterval="7000" :slideritems="thirdItems"></slider-container-13>
    </div>
    <div style="width:50%; height:50%;  display:flex; border:1px solid var(--web_secondary_color);">
        <slider-container-13 :sliderinterval="8000" :slideritems="fourthItems"></slider-container-13>
    </div>
    <div class="SLIDERcontainer9_texts_container"></div>
    <img src="/img/misc/soho-logo.jpg" style="width:200px; height:auto; position:absolute; top:50%; left:50%; transform:translate(-50%,-50%);">
    <transition name="slide-fright-tleft"> 
        <a class="SLIDERcontainer9_phone_container" :href="'tel:+34'+globals.generals.appPhone" v-if="showBio">
            <div class="SLIDERcontainer9_phone_texts_container">
                <i class="SLIDERcontainer9_phone_texts_icon fa fa-phone c_light fs_big"></i>
                <span class="SLIDERcontainer9_phone_texts_title fs_big c_light">Reservar</span>
            </div>
        </a>
    </transition> 
</section>
</template>
<!--SCRIPTS-->
<script>
import { mapState } from 'vuex';
export default {
name: 'SLIDERcontainer9',


computed:
{
    ...mapState('Globals', ['globals']),
    firstItems: function(){ let firstItems = this.slideritems.slice(0,4); return firstItems},
    secondItems: function(){ let secondItems = this.slideritems.slice(4,4); return secondItems},
    thirdItems: function(){ let thirdItems = this.slideritems.slice(8,4); return thirdItems},
    fourthItems: function(){ let fourthItems = this.slideritems.slice(12,4); return fourthItems},
},


props:
{
    slideritems: { required:true }
},


mounted() {
    console.log(this.$options.name+' component successfully mounted');
},


};
</script>

01 Jul
2 months ago

Gabotronix started a new conversation Vue: Commit Mutation From Inside Custom Directive

Hi evwrybody, I want to commit a mutation to the store from inside a custom vue directive I made, is it possible to access it inside the directive context? how about changing data state in a component from a directive?

Here is my code:

Vue.directive('scroll-apply-class', {
    isLiteral: true,
    inserted: (el, binding, vnode) => {

        let scrolled = false;
        let stickyTop = null;

        window.addEventListener('load', function() {
            stickyTop = el.offsetTop;
            checkPosition();
            window.addEventListener('scroll', function() {
                scrolled = true;
            });
        });

        let checkPosition = function(){
            if (window.pageYOffset > stickyTop && window.innerWidth > 765) {
                el.classList.add(binding.value);
                //COMMIT VUEX MUTATION HERE
            }
            else {
                el.classList.remove(binding.value)
                //COMMIT VUEX MUTATION HERE
            }   
        };

        let timeout = setInterval(function() {
            if (scrolled) {
                scrolled = false;
                checkPosition();
            }
        }, 2000);

    }
});
30 Jun
2 months ago

Gabotronix started a new conversation Meaning Of $name => $value When Iterating Arrays

Hi everybody, when looping through arrays I usually see something like this:

foreach ($this->filters() as $name => $value)

I have never used that syntax, I usually go with something like this:

foreach ($this->filters() as $filter) 

What are the differences?

28 Jun
2 months ago

Gabotronix started a new conversation Javascript: Adding A Single Function To Multiple Events

Hi everybody, currently I have something like this:

window.addEventListener('load', function() {
        self.checkIsMobile();
    });

    window.addEventListener('resize', function() {
        self.checkIsMobile();
    }); 

Is it possible to do the same action for multiple events in a single line, something like:

window.addEventListener(['load', 'resize'], function() {
        self.checkIsMobile();
});

Thnaks in advance

Gabotronix left a reply on Make Url Not Appear On Google

@SNAPEY - How can I hide /gestor-contenido-info url from crawlers using robots.txt

My current robots.txt looks like this:

User-agent: *
Disallow:

Gabotronix started a new conversation Make Url Not Appear On Google

Hi everybody, my web has a page (url) which I don't want to appear in google indexes when someone searches my web, I don't want google to index it so only users who I told about the url will know it's actually there, I DO NOT plan to use auth middleware for this, any suggestions on how to achieve this?

25 Jun
2 months ago

Gabotronix started a new conversation Vue: Rendering Images/components With V-for

Hi everybody, I have an app section where various images are showcased, I get this images from an array and I lop through them with v-for to rener them in my component, now inside of that array I added a 'component' property instead of image, I want to render a compnent by name instead of image when specified in my array.

This is my array (backend), I do a json_encode to get it into my frontend (vue).

$globals['bioItems'] = [
            [ 'image' => '/img/misc/pelo-1.jpg', 'component' => false, 'title' => '' ],
            [ 'image' => false, 'component' => 'layout-image-1', 'title' => '' ],
            [ 'image' => '/img/misc/pelo-3.jpg', 'component' => false, 'title' => '' ],
            [ 'image' => '/img/misc/pelo-4.jpg', 'component' => false, 'title' => '' ],
            [ 'image' => '/img/misc/pelo-5.jpg', 'component' => false, 'title' => '' ],
            [ 'image' => '/img/misc/pelo-6.jpg', 'component' => false, 'title' => '' ],   
        ];

And in my component this is how I render the list of images:

<div class="LAYOUThub1_center_row_item_container" v-if="showImages">
            <div class="LAYOUThub1_center_item33_container" v-for="(item,index) in globals.bioItems" :key="index+'F'">
                <transition :name="transitionByIndex(index)" appear>
                <div class="LAYOUThub1_center_item33_image" :style="'background-image:url('+item.image+');'"></div>
                </transition>
            </div>
        </div>

How can I do this?

21 Jun
3 months ago

Gabotronix started a new conversation Error When Running Envoy Task, Server [ Server_name] Is Not Defined

Hi everybody, I'm trying to use laravel envoy task runner to deploy an app with just a command, however when I execute envoy run deploy I het the following error message in terminal.


[email protected]:/var/www/dtcburger.es$ envoy run deploy

In TaskContainer.php line 193:

  Server [web] is not defined.


run [--continue] [--pretend] [--path PATH] [--conf CONF] [--] <task>

[email protected]:/var/www/dtcburger.es$

It can't find my server despite me adding the correct user and IP to @servers array...

This is part of my Envoy.blade.php file:

@servers(['web' => '[email protected]'])

@setup
    $on = 'web';
    $user = 'deployuser';
    $domain = 'gabrielgbtest.com';
    $repo = '[email protected]:GabotronES/projectname.git';
@endsetup


@story('deploy')
    clone
    dependencies
    migrations
    perms
    nginx
    ssl
@endstory


@task('pull', ['on' => $on, 'confirm' => true])
    git fetch origin master
    git reset --hard origin/master
@endtask

Any idea what I'm doing wrong?

17 Jun
3 months ago

Gabotronix started a new conversation Envoy And Connecting Via Ssh With Username With Capitals

Hi everybody, I recently installed laravel envoy task runner, when I try to run a task with command envoy run deploy I get the following error:

[email protected]:/var/www/dtcburger.es$ envoy run deploy
Are you sure you want to run the [echo] task? [y/N]: y
[GabotronES:206.189.X.XX]: ssh: Could not resolve hostname gabotrones:206.189.X.XX: Name or service not known
[✗] This task did not complete successfully on one of your servers.

It says it can't resolve hostname gabotrones but my ubuntu user is GabotronES, in my Envoy.blade.php I have also user GabotronES in @servers directive, is this because envoy doesn't allow username with capitals to connect via ssh?


@servers(['web' => 'GabotronES:206.189.X.XX'])

*censored my IP just in case

16 Jun
3 months ago

Gabotronix started a new conversation Laravel Apps, DigitalOcean And CPU/RAM Usage

Hi everybody, I currently have a DigitalOcean VPS with 1GB and v3CPU, my apps run fine with this but I'm thinking about upgrading to the 20 dllars/month plan, however something caught my attention, the 20month plan has 3GB more of RAM but one less of CPU, this seems pretty weird to me to be honest, I don't know if laravel apps are more CPU heavy than RAM so I'm looking for some advice, I doon't want to shoot myself in the foot by upgrading to a plan which could negatively affect the performance of my apps, my webs are all middel-sized laravel apps.

https://i.imgur.com/3WbtDnX.png

Can someone shed some light on me?

Gabotronix left a reply on Running Out Of Memory Trying To Install Envoy Globally On Production Server

@DEANSATCH - What ubuntu commands would help me identify proccesses which are taking lots of memory= and to kil them? sorry for noob question.

15 Jun
3 months ago

Gabotronix started a new conversation Running Out Of Memory Trying To Install Envoy Globally On Production Server

Hi everybody, I have a DigitalOcean VPS I pay 15 bucks monthly for, I'm trying to install laravel envoy task runner with this command:

composer global require laravel/envoy

But I get the following error:


mmap() failed: [12] Cannot allocate memory

mmap() failed: [12] Cannot allocate memory
PHP Fatal error:  Out of memory (allocated 459276288) (tried to allocate 2131644 bytes) in /usr/share/php/Composer/Util/RemoteFilesystem.php on line 419

Fatal error: Out of memory (allocated 459276288) (tried to allocate 2131644 bytes) in /usr/share/php/Composer/Util/RemoteFilesystem.php on line 419

Any ideas ?

14 Jun
3 months ago

Gabotronix started a new conversation User Deploy Is Currently Used By Process 10210 In Ubuntu VPS

Hi everybody, I'm trying to set the home directory for a deploy user I changed the name using usermod -d /home/user user command, however I'm getting the following error message:

user deploy is currently used by process 10210

Command it's not taking effect, I'm still a noob with ubutu so please help me out.

13 Jun
3 months ago

Gabotronix started a new conversation Envoy, Putty, SSH Keys And Connecting To Ubuntu VPS

Hi everybody, I recently started to read about envoy, a suitable way to deploy my apps with a single command, it uses blade syntax too so it's a win-win, however there's an issue, I have been coonecting to my VPS with Putty and using a really hard to guess password (afaik a brute force attack would break my barrier), I have also read about SSH key pairs and honestly I'm a bit scared if I the private key file I'd get locked out of my server.

So I have a few questions:

-Once I create my SSH key pair, if I save these files into say Google Drive or similar, if I lose my laptop or gets stolen will I still be able to access my servers with the backup key files from my google drive accound?

-Would it be possible to run envoy run deploy command if have password auth instead f SSH keys? I haven't tried yet but maybe it'll ask me for my sudo password for a few commands (sudo, git) but that doesn't sound too bad honestly...

Thanks in advance.

09 Jun
3 months ago

Gabotronix left a reply on Can't Set Background Image With Vue

Issue was with spaces in the image name, it's solved now

Gabotronix left a reply on Can't Center Div Inside Slick-slider Item With Flex

@AURAWINDSURFING - I don't use tailwind css (never used a css framework before), I fixed this by using display:flex !important...

Gabotronix started a new conversation Vue: Issue With Reactive Object Not Updating?

Hi everybody, I have an item card component I set with an v-for, inside each component you can increase or decrease the number of items the user want to add to the cart, when I click I get an alert and the count increases/decreases as it should but the value discount.quantity doesn't update in mu view, it's always 1 (default value).

I know about reactivity caveats and I'm using Vue.set to make the property reactive but it's not updating... check my component:

<template>
<div class="DISCOUNTlist6_item_container shadow">
    <div class="DISCOUNTlist6_item_texts_container">
        <div class="DISCOUNTlist6_item_texts_quantity_container" style="width:100%; height:auto; display:flex;  justify-content:space-between; flex-wrap:no-wrap; margin:20px 0px 0px 0px;">
            <div class="DISCOUNTlist6_item_texts_quantity_row_container" style="width:35%; height:40px; display:flex;">
                <button class="DISCOUNTlist6_item_texts_quantity_button" @click="decreaseQuantityByOne()" style="width:40px; height:40px; display:flex; align-items:center; justify-content:center; background-color:rgb(10,10,10);" type="button"><i class="fa fa-minus fs_smaller c_light"></i></button>
                <div class="DISCOUNTlist6_item_texts_quantity_number fs_big c_normal" style="flex:1; height:100%; display:flex; align-items:center; background-color:white; justify-content:center;">{{ discount.quantity }}</div>
                <button class="DISCOUNTlist6_item_texts_quantity_button" @click="increaseQuantityByOne()" style="width:40px; height:40px; display:flex; align-items:center; justify-content:center; background-color:rgb(10,10,10);" type="button"><i class="fa fa-plus fs_smaller c_light"></i></button>
            </div>
            <button class="DISCOUNTlist6_item_texts_quantity_cart_button secondary fs_big" @click="getDiscountData()" :disabled="!globals.auth" style="width:62%; height:40px; background-color:var(--web_primary_color);">Añadir al carrito</button>
        </div>
    </div>
</div>
</template>
<!--SCRIPTS-->
<script>
import { mapState, mapActions, mapMutations } from 'vuex';
export default {
name: 'DISCOUNTcard5',


props:
{
    discount: {required:true},
},


methods:
{
  

    ...mapActions('Cart', ['addProductToCart']),

    decreaseQuantityByOne: function()
    {
        if(this.discount.quantity > 1){
            this.discount.quantity = this.discount.quantity - 1;
        }
    },


    increaseQuantityByOne: function()
    {
        if(this.discount.quantity < this.discount.stock_left){
            //this.discount.quantity = this.discount.quantity + 1;
            //Vue.set(this.discount, 'quantity', this.discount.quantity + 1)
            this.$set(this.discount, 'quantity',  this.discount.quantity + 1)
            alert(this.discount.quantity);
        }
    },
}


};
</script>
07 Jun
3 months ago

Gabotronix left a reply on Automating Tasks With Commands In Ubuntu Enviroment

I'm also reading about laravel artisan commands, they look reay handy for mysql operations like creating/deleting a database, is this good practice? loging and exiting mysql from the command to do some ops gets a little boring

06 Jun
3 months ago

Gabotronix left a reply on Prevent Event Propagation In Vue

@HAMZAKHCHICHINE - Thanks, so maybe prevent is to stop the event from going down the DOM tree and stop from going up?

Gabotronix started a new conversation Question About Php Proccesses In Linux VPS

Hi everybody, I have a DigitalOcean VPS with ubuntu where I'm running various laravel apps, I recently updated PHP to 7.3, I did this by tweaking my nginx server block files to use the 7.3 fpm socket, now I learn of the ps command that shows procceses running in my linux machine, I decided to do a ps aux | grep php and this shows the following screen:

https://i.imgur.com/ZLSXE9k.png

Well, I'm a noob with ps command but I can clearly see three php procceses running right? one for 7.3 and two of older versions, now this let me wondering if these lower than 7.3 procceses are cluttering my linux machine with unneeded overhead...

If thats the case what command can I use to remove old php, php-fpm, and other old php extensions (lower than 7.3 versions) ?

Someone shed some light on me please.

Also do you guysknow of any good starting point for learning linux server management, I want to know about useful commands like this one.

Gabotronix started a new conversation Prevent Event Propagation In Vue

Hi everybody, I have a list of available cards for online payments with stripe, there I have a button with an icon inisde, if you click the button or the icon both fire different method, however when the icon is clicked (icon is inside the button), the button method also fires, I want to avoid this but so far havne't find a way.

<button class="STRIPElist2_cardlist_container" @click.stop="setDefaultSource({ id: source.id }); SET_LOADER_ID(7563);" :class="{ 'active_card' : customerDefaultSource == source.id }" type="button" v-for="(source, index) in customerSources" :key="index">
            <div class="STRIPElist2_cardlist_radio_container">
                <div class="STRIPElist2_cardlist_radio_inner" :class="{ 'active_radio' : customerDefaultSource == source.id }"></div>
            </div>
            <span class="STRIPElist2_cardlist_text fs_normal c_normal four">✱✱✱✱ ✱✱✱✱ ✱✱✱✱ {{ source.card.last4 }}</span>
            <span class="STRIPElist2_cardlist_text fs_normal c_normal brand">{{ source.card.brand }}</span>
            <span class="STRIPElist2_cardlist_text fs_normal c_normal exp">{{ source.card.exp_month }} / {{ source.card.exp_year }}</span>
            <i class="STRIPElist2_cardlist_close fa fa-times fs_big c_normal" @click.prevent.self="deleteSource({ id: source.id }); SET_LOADER_ID(7563);"></i>
        </button>
30 May
3 months ago

Gabotronix started a new conversation Issue With HasManyThrough Relationship

I created four models: Item, ItemOption, ItemSize, ItemColor. My intention is to create an online shop, I want to have an online shop, say I create an article shirt, then I can add many variables (options) of that same shirt, particulary colors, sizes... each option with it's own stock. I set these models with a hasManyThrough relationship but then I get this error:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'item_colors.item_option_id' in 'on clause' (SQL: select `item_colors`.*, `item_options`.`item_id` as `laravel_through_key` from `item_colors` inner join `item_options` on `item_options`.`id` = `item_colors`.`item_option_id` where `item_options`.`item_id` in (1))

These are my migrations:

Schema::create('item_options', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('item_id')->index()->nullable();
            $table->foreign('item_id')->references('id')->on('items')->nullable();
            $table->unsignedInteger('item_size_id')->index()->nullable();
            $table->foreign('item_size_id')->references('id')->on('item_sizes')->nullable();
            $table->unsignedInteger('item_color_id')->index()->nullable();
            $table->foreign('item_color_id')->references('id')->on('item_colors')->nullable();
            $table->timestamps();
        });


Schema::create('items', function (Blueprint $table) {
            $table->increments('id');
            $table->string('image')->nullable();
            $table->string('title');
            $table->decimal('finalPrice', 5,2);
            $table->text('body');
            $table->timestamps();
        });

Schema::create('item_colors', function (Blueprint $table) {
            $table->increments('id');
            $table->string('title');
            $table->string('colorCode');
            $table->timestamps();
        });

Schema::create('item_sizes', function (Blueprint $table) {
            $table->increments('id');
            $table->string('title');
            $table->timestamps();
        });

And my models:

class Item extends Model
{
    
    
    protected $table = 'items';
    
    
    public function options()
    {
        return $this->hasMany(ItemOption::class);
    }

    public function sizes()
    {
        return $this->hasManyThrough(ItemSize::class, ItemOption::class);
    }

    public function colors()
    {
        return $this->hasManyThrough(ItemColor::class, ItemOption::class);
    }

    
}


class ItemOption extends Model
{
    
    protected $fillable = ['item_id', 'item_color_id', 'item_size_id', 'stock'];

    public function color()
    {
        return $this->belongsTo(ItemColor::class);
    }

    public function size()
    {
        return $this->belongsTo(ItemSize::class);
    }

    
}
29 May
3 months ago

Gabotronix started a new conversation Can't Center Div Inside Slick-slider Item With Flex

Hi everybody, I made a slick slider component in vue, I'm trying to center a circular div inside each one of the slider items but I can't get tit to work, it centers horizontally after I added margin:auto but it doesn't center vertically despite using align and justify center, any idea how I can get this to work? I think it has something to do with how slick slider changes the width of the slick items via javascript...

<template>
<slick class="SLIDERcontainer6_maincontainer" ref="slick" :options="slickOptions">
    <div class="SLIDERcontainer6_item_container" v-for="slider in globals.producsSlider" :key="slider.title">
        <div class="SLIDERcontainer6_item_image" :style="'background-image:url('+slider.image+');'"></div>
    </div>
</slick>
</template>
<!--SCRIPTS-->
<script>
import { mapState } from 'vuex';
import Slick from 'vue-slick';
export default {
name: 'SLIDERcontainer10',


components: { Slick },


computed:
{
    ...mapState('Globals',['globals'])
},


data()
{
    return {
        slickOptions: {
        infinite: true,
        slidesToShow: 4,
        slidesToScroll: 1,
        prevArrow: '<i class="fa fa-chevron-left fs_bigger c_light" style="position:absolute; left:10px; top:50%; transform:translateY(-50%); z-index:99999;"></i>',
        nextArrow: '<i class="fa fa-chevron-right fs_bigger c_light" style="position:absolute; right:10px; top:50%; transform:translateY(-50%); z-index:99999;"></i>',
        arrows: true,
        autoplay: true,
        speed: 2000,
        autoplaySpeed: 4000,
        responsive: 
        [
        {
        breakpoint: 1120,
            settings: 
            {   
            slidesToShow: 3,
            slidesToScroll: 1,
            }
        },
        {
            breakpoint: 800,
            settings: 
            {
            slidesToShow: 2,
            slidesToScroll: 2
            }
        },
        {
            breakpoint: 600,
            settings: 
            {
            slidesToShow: 1,
            slidesToScroll: 1
            }
        }]
        },

    };
},


beforeUpdate()
{
    if (this.$refs.slick) {
        this.$refs.slick.destroy();
    }
},


updated()
{
    this.$nextTick(function () {
        if (this.$refs.slick) {
            this.$refs.slick.create(this.slickOptions);
        }
    });
},


mounted()
{
    console.log(this.$options.name+' component successfully mounted');

},


};
</script>
<!--STYLES-->
<style scoped>
.SLIDERcontainer6_maincontainer{width:100%; height:auto; position:relative;}
.SLIDERcontainer6_item_container{width:33.33%; height:350px; display:flex; flex-direction:column; align-items:center; justify-content:center; background-color:var(--web_primary_color); position:relative;}
.SLIDERcontainer6_item_image{width:275px; height:275px; border-radius:50%; background-size:cover; background-position:center; margin:auto; align-self:center;}
@media only screen and (max-width: 736px) 
{
}
</style>

27 May
3 months ago

Gabotronix started a new conversation Help With Shop Items Many To Many Relationship

Hi everybody, I'm working on an e-commerce web where you can buy some items, say shirts... I have three models Item, ItemColor and ItemSize. I have set up a many to many relationship where an item in the shop can have many colors and many sizes available but each of these items will have a stock on it's own, here is where things get complicated for me.

If I create an item, for example a shirt X, I can attach to that shirt different colors and sizes available (many to many), a shirt with black color and size M will have three in stock, but how can I set up so each type of shirt has a stock?? I'm failing to see this in a clear way...

Where should I put stock attribute? in pivot table maybe?

Here are my models and migrations:

//item model
protected $table = 'items';
    
    
    public function colors()
    {
        return $this->belongsToMany('App\Models\ItemColor');
    }

    public function sizes()
    {
        return $this->belongsToMany('App\Models\ItemSize');
    }

//tiemsize model

protected $table = 'item_sizes';
    
    
    public function items()
    {
        return $this->belongsToMany('App\Models\Item');
    }

//item colors

protected $table = 'item_colors';
    
    
    public function items()
    {
        return $this->belongsToMany('App\Models\Item');
    }

And migrations


//pivot table
Schema::create('item_size_color', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('item_id')->index();
            $table->foreign('item_id')->references('id')->on('items');
            $table->unsignedInteger('item_size_id')->index();
            $table->foreign('item_size_id')->references('id')->on('item_sizes');
            $table->unsignedInteger('item_color_id')->index();
            $table->foreign('item_color_id')->references('id')->on('item_sizes');
            $table->timestamps();
        });

//items table
Schema::create('items', function (Blueprint $table) {
            $table->increments('id');
            $table->string('title');
            $table->timestamps();
        });

//items color table
Schema::create('item_colors', function (Blueprint $table) {
            $table->increments('id');
            $table->string('title');
            $table->timestamps();
        });

//items size table
Schema::create('item_sizes', function (Blueprint $table) {
            $table->increments('id');
            $table->string('title');
            $table->timestamps();
        });

Mock up controller method, how can I set stock?

public function create(Create $request)
    {
        $item = new Item();
        $item->colors->attach($request->input('availableColors'));
        $item->sizes->attach($request->input('availableSizes'));
        $item->sizes = $request->input('color');
        $title = $request('title');
        if($request->hasFile('image')){ $item->image = $this->uploadFile($request, 'image'); }
        $item->save();

        $item->load('sizes');
        $item->load('colors');

        
        return response()->json([
            'item' => $item,
        ]);
        
    }
26 May
3 months ago

Gabotronix started a new conversation Error When Running Npm Run Prod In Production

Hi everybody, I'm experiencing same error over and over again when I run npm run prod in my VPS, no issue with my local dev machine:

This is the error:


$ npm run prod

> @ prod /var/www/dtcburger.es
> npm run production


> @ production /var/www/dtcburger.es
> cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js

internal/child_process.js:313
    throw errnoException(err, 'spawn');
    ^

Error: spawn ENOMEM
    at ChildProcess.spawn (internal/child_process.js:313:11)
    at exports.spawn (child_process.js:508:9)
    at Object.exports.fork (child_process.js:109:10)
    at fork (/var/www/dtcburger.es/node_modules/worker-farm/lib/fork.js:17:36)
    at Farm.startChild (/var/www/dtcburger.es/node_modules/worker-farm/lib/farm.js:106:16)
    at Farm.processQueue (/var/www/dtcburger.es/node_modules/worker-farm/lib/farm.js:279:10)
    at Farm.<anonymous> (/var/www/dtcburger.es/node_modules/worker-farm/lib/farm.js:97:21)
    at ontimeout (timers.js:498:11)
    at tryOnTimeout (timers.js:323:5)
    at Timer.listOnTimeout (timers.js:290:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ production: `cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ production script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/gabotron/.npm/_logs/2019-05-26T16_59_29_167Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ prod: `npm run production`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ prod script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/gabotron/.npm/_logs/2019-05-26T16_59_29_200Z-debug.log

Gabotronix started a new conversation Running Npm Run Prod In Production

Hi everybody, I have a few production apps in my DO VPS, I have laravel-mix versioning enabled but I have noticed the nly way for my css to be updated instead of showing the ld css design is to run npm run prod in my ubuntu server, I have a few questions regarding this:

-1) Why do I have to do npm run prod for my webs to show updated design instead of cached one (this is particulary stinky in mobile chrome).

-2) Is running npm run prd in prduction a good idea, I don't want to cause a mess.

I'm also a lon developer/learner so I don't work in a team, just in case.

25 May
3 months ago

Gabotronix started a new conversation Issue Creating Log Files With Nano And &&

Hi everybod, in my ubuntu VPS I'm trying to get three commands to run after each other using &&, what I do is create a folder and inside that folder I create two log files using nano, this however doesn't create the log files, only the mai folder, after running the bellow command it tells me file is not writtable and to save into buffer, so I just cancel the operation with no log files created... This are the commands:

sudo mkdir /var/log/peter.com && nano /var/log/peter.com/access.log && nano /var/log/peter.com/error.log

Gabotronix left a reply on Failed To Open Stream When Uploading File Via Ajax

Okk, after checking uploads folder perms inside public they were: rwx r-x --x, I did a chmod 770 to uploads and now everything works, what do you guys think, I hope I didn't do anything risky.

I want to show you guys the commands I now use fot setting perms so you can give me your thoughs:

cd /var/www/luisaldada.com
sudo chown GabotronES:ww-data /var/www/luisaldada.com
&&
find /var/www/luisaldada.com -type d -exec chmod 755 {} \;
&&
find /var/www/luisaldada.com -type f -exec chmod 644 {} \;
&&
chmod 770 /var/www/luisaldada.com/public/uploads
&&
setfacl -Rdm u:www-data:rwx,u:GabotronES:rwx storage bootstrap/cache
&&
setfacl -Rm u:www-data:rwx,u:GabotronES:rwx storage bootstrap/cache

Gabotronix started a new conversation Failed To Open Stream When Uploading File Via Ajax

Hi everybody, I have a laravel app in production DigitalOcean VPS with ubuntu and LEMP , web works perfectly but it seems I can't upload files from my web, when I try to upload image via ajax I get the following error (only in production, local works right):

message fopen(/var/www/luisaldada.com/public/uploads/file-25-05-2019-21-39-MAL-421.jpeg): failed to open stream: Permission denied
exception   ErrorException
file    /var/www/luisaldada.com/vendor/league/flysystem/src/Adapter/Local.php
line    158

This looks like an obvious permission error but I already gave write perm recursively to laravel storage folder, I'm using laravel public/local disk to upload files into an upload folder inside public.

filesystems config file:

'public' => [
            'driver' => 'local',
            'root' => public_path(),
            'url' => env('APP_URL').'/storage',
            'visibility' => 'public',
        ],

Maybe it has something to do with public folder not having correct permissions to upload/write?

This are my permisions for laravel folder, as you can see I have gone as far as to set ACL for storage folder.

https://i.imgur.com/LLYIECc.png

This is how I upload file in contrller just in case:

$file = $request->file($name);
        $filename = 'file-'.Carbon::now()->format('d-m-Y-H-i').'-'.str_random(3).'-'.mt_rand('000','999').'.'.$file->extension();
        $file->storeAs('uploads', $filename);

Gabotronix left a reply on Question About Laravel And Nginx Logs

Okk that made things more clear, thanks guys!

Gabotronix started a new conversation Question About Laravel And Nginx Logs

Hi everybody, I have a noob question. On my lemp stacl I always define access and error log files for nginx in /var/log/appname folder and then in my nginx conf I have:

access_log /var/log/clunkertree.com/access.log;
    error_log /var/log/clunkertree.com/error.log;

I also know that laravel has laravel.log file in storage, in this file all errors such as 404, 500, Exceptions are logged, now I just checked my access.log file and it has many lines, all right but ALL my error logs are empty, this has led me to believe that I shouldn't really be creating a error.log file since it appears all laravel errors are logged into laravel.log file, onlu an access.log and laravel's default laravel.log file will suffice, am I mistaken??

Gabotronix started a new conversation Artisan Command To Create Nginx Log Files

Hi everybody, in my DigitalOcean VPS I have a lemp stack, I usually create access.log and error.log inside /var/log directory, now I just learnt of laravel artisan comands and I'm starting to read about them, I want to create an artisan command to automate some tasks, this is my first attempt and I want suggestions and advice, am I doing good with a try catch for error handling?

Basically I want this comand to create a folder and if successfull, create two log files for nginx web server:

<?php
namespace App\Console\Commands;


use Illuminate\Console\Command;
use Exception;


class CreateNginxLogs extends Command
{
    protected $description = 'This command creates access and error logs for nginx web server';
    protected $signature = 'log:create nginx';


    public function handle()
    {
        
        $path = '/var/log/'.config('app.domain');

        try
        {
            mkdir($path, 0775, true);

            fopen($path.'/access.log', 'w');

            fopen($path.'/error.log', 'w');
        }
        catch(Exception $e)
        {
            echo($this->error($e->getMessage()));
        }
          
    }

}

Will this even work?

Gabotronix started a new conversation Error When Restarting Nginx Service In Ubuntu

Hi everybody, I have a DigitalOcean VPS where I host some production apps, when I try to do sudo service nginx restat or systemctl restart nginx.service I get the following error:

https://i.imgur.com/zumXbeZ.png

I ran sudo nginx -t and conf and syntax are ok, wha twould be the problem?

My production apps also appear to work properly.

24 May
3 months ago

Gabotronix started a new conversation Automating Tasks With Commands In Ubuntu Enviroment

Hi everybody, prior to deploying my web projects I usually do some tasks like creating log folder and files for nginx , this usually involves running following commands:

mkdir /var/log/domain.com nano /var/log/domain.com/access.log nano /var/log/domain.com/error.log

No w I was wondering if I can run this three commands with a single command like:

create logs domain.com 

Gabotronix left a reply on Issue With Relationship

@SNAPEY - Okk I added fk to shirt migrations and the tables were created succesfully, but now when I create a shirt I get the following error:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'shirt_sizes.shirt_id' in 'where clause' (SQL: select * from `shirt_sizes` where `shirt_sizes`.`shirt_id` in (3))

This is my shirt migration now:

Schema::create('shirts', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('shirt_color_id')->index();
            $table->foreign('shirt_color_id')->references('id')->on('shirt_colors');
            $table->unsignedInteger('shirt_size_id')->index();
            $table->foreign('shirt_size_id')->references('id')->on('shirt_sizes');
            $table->integer('stock');
            $table->string('url')->unique();
            $table->string('slug')->unique();
            $table->string('title')->unique();
            $table->longText('body')->nullable();
            $table->string('image')->nullable();
            $table->boolean('isVisible')->default(false);
            $table->boolean('isFeatured')->default(false);
            $table->boolean('beenPublished')->default(false);
            $table->boolean('scheduleForMail')->default(false);
            $table->timestamps();
        });

Gabotronix started a new conversation Issue With Relationship

Hi everbody, I' m trying to make a relationship with laravel, a shirt has one color and one size, colors and sizes can belong to many shirts.

I get the following error when I migrate:

SQLSTATE[HY000]: General error: 1005 Can't create table `laplazitaa`.`#sql-33d0_17d` (errno: 150 "Foreign key constraint is incorrectly formed") (SQL: alter table `shirt_colors` add constraint `shirt_colors_shirt_id_foreign` foreign key (`shirt_id`) references `shirts` (`id`))

This are my migration files in detail:

Schema::create('shirts', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('stock');
            $table->string('url')->unique();
            $table->string('slug')->unique();
            $table->string('title')->unique();
            $table->longText('body')->nullable();
            $table->string('image')->nullable();
            $table->boolean('isVisible')->default(false);
            $table->boolean('isFeatured')->default(false);
            $table->boolean('beenPublished')->default(false);
            $table->boolean('scheduleForMail')->default(false);
            $table->timestamps();
        });

Schema::create('shirt_colors', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('shirt_id')->index();
            $table->foreign('shirt_id')->references('id')->on('shirts');
            $table->string('title');
            $table->string('colorCode');
            $table->boolean('isVisible')->default(true);
            $table->timestamps();
        });

Schema::create('shirt_sizes', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('shirt_id')->index();
            $table->foreign('shirt_id')->references('id')->on('shirts');
            $table->string('title');
            $table->boolean('isVisible')->default(true);
            $table->timestamps();
        });

And my models:

//Shirt
protected $table = 'shirts';


    public function color()
    {
        return $this->hasOne('App\Models\ShirtColor');
    }


    public function size()
    {
        return $this->hasOne('App\Models\ShirtSize');
    }
//ShirtColor

protected $table = 'shirt_colors';


    public function shirts()
    {
        return $this->belongsToMany('App\Models\Shirt');
    }

//ShirtSize

 protected $table = 'shirt_sizes';


    public function shirts()
    {
        return $this->belongsToMany('App\Models\Shirt');
    }

Any idea what I'm doing wrong?

Gabotronix left a reply on Serve Multiple Laravel Apps On Localhost With Php Artisan Serve

I ran:

php artisan serve -port 8001

in my local dev lamp stack and it worked perfectly, I just wanted to see various web designs at once so it's all good, thanks everybody

23 May
3 months ago

Gabotronix started a new conversation Serve Multiple Laravel Apps On Localhost With Php Artisan Serve

Hi everybody, I'd like to be able to serve more than one laravel app at the same time on different tabs/ports, this is so I can showcase various designs, sadly when I run php artisan serve I can get only one app running at a time on port 8000.

Even after updating to laravel 5.8, form the docs:

Artisan Serve Improvements
In previous releases of Laravel, Artisan's serve command would serve your application on port  8000. If another serve command process was already listening on this port, an attempt to serve a second application via serve would fail. Beginning in Laravel 5.8, serve will now scan for available ports up to port 8009, allowing you to serve multiple applications at once.

Is there anything I'm missing?

Gabotronix started a new conversation Seeding/Creating Many-to-many Relationships

Hi everybody, I have tow models Winner and Competition, a winner may have won many competitions and a competition may have been won by many winners, this to me is a many-to-many relationship.

Now I created my two migrations and pivot table migration:

Schema::create('winners', function (Blueprint $table) {
            $table->increments('id'); 
            $table->string('instagram');
            $table->timestamps();
        });

Schema::create('competitions', function (Blueprint $table) {
            $table->increments('id'); 
            $table->string('name');
            $table->timestamps();
        });

Schema::create('winner_competition', function (Blueprint $table) {
            $table->integer('winner_id')->unsigned();
            $table->integer('competition_id')->unsigned();
            $table->foreign('winner_id')->references('id')->on('winners')->onDelete('cascade')->onUpdate('cascade');
            $table->foreign('competition_id')->references('id')->on('competitions')->onDelete('cascade')->onUpdate('cascade');
        });

Now I want to seed create a few winners but I don't know how I should assign a competition to a winner in seed file and controller method:

public function create(Create $request)
    {
        $winner = new Winner();
        $winner->instagram = $request->input('instagram');
        $winner->competition_id = '?';
        $winner->save();
        
        return response()->json([
            'winner' => $winner
        ]);
    }

DB::table('winners')->insert([
            'instagram' => '@hfgfgdhdd',
            'competition_id' => '?'
        ]);

Someone shed some light on me.

22 May
4 months ago

Gabotronix started a new conversation Can't Set Background Image With Vue

Hi everybody, I have a component where I display a list of post_categories, each post_category has an image attribute and I create these like:

DB::table('postcategories')->insert([
            'title' => 'Clases',
            'url' => '/publicaciones/clases',
            'slug' => 'clases',
            'image' => '/img/photos/dogs (20).jpg',
        ]);
        DB::table('postcategories')->insert([
            'title' => 'Problemas de conducta',
            'url' => '/publicaciones/problemas-de-conducta',
            'slug' => 'problemas-de-conducta',
            'image' => '/img/photos/dogs (21).jpg',
        ]);

The models get created right but when I want to set background image inside v-dor it doesn't work, however if instead of div with background-image I use an img tag with src it works, why can't I use background-image instead?

<template>
    <div class="POSTcard2_maincontainer shadow" :href="post.url">
        <div class="POSTcard2_image_container">
            <!--THIS DOESN'T WORK--><a class="POSTcard2_image" :style="'background-image:url('+post.image+');'"></a>
            <!--THIS WORKS--><img class="POSTcard2_image" v-if="post.image" :src="post.image">
            <div class="POSTcard2_title_container">
                <span class="POSTcard2_title_text c_normal bold c_light">{{ post.title }}</span>
                <div class="POSTcard2_title_button">
                    <i class="POSTcard2_title_button_icon fa fa-chevron-right fs_big c_light" ></i>
                </div>
            </div>
        </div>
    </div>
</template>
21 May
4 months ago

Gabotronix started a new conversation Help With Shirt -> Colors -> Sizes Laravel Relationship

Hi everybody, I'm trying to wrap my head about this relationship which I think is many-to-many, I have 3 models, a shirt model, a shirt color model and a shirtsize model. Now this is how I see things, I could say:

One shirt can be many colors and many sizes but you could also say a shirt will be ONE color and ONE size (a shirt can't be multiple colors/sizes at once...) , so this got me pretty confused. I got the feeling this has to be a many to many relationship between shirt, size and color but I'm not so sure how (and if I should) do this?

This are my migrations:

Schema::create('shirts', function (Blueprint $table) {
            $table->increments('id');
            $table->string('slug')->unique();
            $table->string('url')->unique();
            $table->string('title')->unique();
            $table->longText('body');
            $table->decimal('finalPrice', 5,2);
            $table->integer('totalCount');
            $table->string('image')->nullable();
            $table->boolean('isVisible')->default(false);
            $table->boolean('beenPublished')->default(false);
            $table->boolean('scheduleForMail')->default(false);
            $table->timestamps();
        });


Schema::create('shirtcolors', function (Blueprint $table) {
            $table->increments('id'); 
            $table->string('title');
            $table->string('hexColor');
            $table->timestamps();
        });



Schema::create('shirtsizes', function (Blueprint $table) {
            $table->increments('id'); 
            $table->string('title')->nullable();
            $table->timestamps();
        });

Gabotronix left a reply on Merging Two Collections Only Returns One

@JLRDW - I want to merge both arrays into one but I only get an array with posts, I want ONE array with posts AND events, for some reason merge is not working.

Gabotronix started a new conversation Merging Two Collections Only Returns One

Hi everybody, I have two laravel collections (posts and events), I merge both into a new cllection called sliderItems, hoever this collection only returns one of the collections intead of a merged one with both, in this case only posts.

$sliderPosts = Post::where('isFeatured', true)->where('isVisible', true)->with('postcategory')->latest()->get();
        //dump($sliderPosts);
        $sliderEvents = Event::where('isFeatured', true)->where('isVisible', true)->latest()->get();
        //dump($sliderEvents);
        $sliderItems = $sliderEvents->merge($sliderPosts)->take(4);
        //dump($sliderItems);
19 May
4 months ago

Gabotronix started a new conversation Pause/Play In My Custom Vue Slider

Hi everybody, I made a custom vue slider and it works so far but I had the idea to add pause/play button to my slider, issue is I don't know how can I handle pausing and resuming setInterval of my slider, I want a function to toggle pause/play in my component:

Here is my component:

<template>
<section class="SLIDERcontainer8_maincontainer">
    <transition-group name="slider-fade">
        <div class="SLIDERcontainer8_image move" :style="'background-image:url('+item.image+');'" v-for="(item, index) in slideritems" :key="item.title" :class="{ 'active_slider' : activeslider == index }"></div>
    </transition-group>
    <div class="SLIDERcontainer8_dots_container">
        <button class="SLIDERcontainer8_dot fs_normal c_light" :class="{ 'active_dot' : index == activeslider }" v-for="(slider, index) in slideritems" :key="index" @click="goToSlider(index)" type="button">{{ slider.title }}</button>
    </div>
</section>
</template>
<!--SCRIPTS-->
<script>
import { mapState } from 'vuex';
export default {
name: 'SLIDERcontainer7',


computed:
{
    ...mapState('Globals', ['globals'])
},


props:
{
    sliderinterval: { default: 5000, type: Number },
    slideritems: { required:true }
},


data() {
    return {
        sliderTimer: 0,
        activeslider: 0,
    }
},


mounted() {
    console.log(this.$options.name+' component successfully mounted');
    this.startSlider();
},


methods:{


    startSlider() {
        var self = this;
        this.activeslider = 0;
        clearInterval(this.sliderTimer);
        this.sliderTimer = setInterval(() => {
        self.nextSlider() }, self.sliderinterval);
    },


    prevSlider() {
        if(this.activeslider == 0){
            this.activeslider = this.slideritems.length - 1;
        }
        else{
            this.activeslider = this.activeslider - 1;
        }
    },


    nextSlider() {
        if(this.activeslider == this.slideritems.length - 1){
            this.activeslider = 0;
        }
        else{
            this.activeslider = this.activeslider + 1;
        }
    },


    goToSlider (sliderIndex) {
        var self = this;
        this.activeslider = sliderIndex;
        clearInterval(this.sliderTimer);
        this.sliderTimer = setInterval(() => {
        self.nextSlider() }, self.sliderinterval);
        
    },

}


};
</script>
<!--STYLES-->
<style scoped>
.active_slider{display:flex !important;}
.active_dot{background-color:var(--web_primary_color) !important;}
.SLIDERcontainer8_maincontainer{width:100%; height:70vh; position:relative; overflow:hidden; margin:0px 0px 0px 0px;}
.SLIDERcontainer8_image{display:none; width:100%; height:100%; background-size:cover; background-position:center; position:absolute; top:0px; left:0px;}
.SLIDERcontainer8_dots_container{width:100%; height:75px; flex-wrap:no-wrap; background-color:rgba(49,47,84,0.95); display:flex; justify-content:center; align-items:center; position:absolute; bottom:0px; left:0px;}
.SLIDERcontainer8_dot{cursor:pointer; height:100%; display:flex; border-right:1px solid rgba(0,0,0,0.2); align-items:center; justify-content:center; text-align:center; flex:1; padding:0px 20px;}
.SLIDERcontainer8_dot:hover{background-color:var(--web_primary_color) !important;}
@media only screen and (max-width: 736px) 
{
.SLIDERcontainer8_maincontainer{width:100%; height:250px; position:relative; overflow:hidden; margin:0px 0px 0px 0px;}
.SLIDERcontainer8_image{display:none; width:100%; height:100%; background-size:cover; background-position:center; position:absolute; top:0px; left:0px;}
.SLIDERcontainer8_dots_container{width:100%; height:40px; flex-wrap:no-wrap; background-color:rgba(49,47,84,0.95); display:flex; justify-content:center; align-items:center; position:absolute; bottom:0px; left:0px;}
.SLIDERcontainer8_dot{width:15px; height:15px; text-indent: -9999px; background-color:white; display:flex; border-radius:50%; margin:0px 5px; border-right:0px solid rgba(0,0,0,0.2); align-items:center; justify-content:center; text-align:center; flex:none; padding:0px 0px;}
.SLIDERcontainer8_dot:hover{background-color:var(--web_primary_color) !important;}
}
</style>


Please help me out.

16 May
4 months ago

Gabotronix left a reply on Cache Busting With Laravel Mix.version() Not Working

After seeing another comment I ran npm run production and now the manifest file shows hashed paths as it should, now this may seem like a noobish question and I'm indeed one, I have a DigitalOcean production server where I hos my apps, I have NEVER ran npm run production for my laravel/vue app to work, I just use git to clone files into /var/www/app, do a composer install and npm install and voila, so... maybe I should use npm run production after pulling changes from git into my live server? can someone shed some light on this?

Gabotronix started a new conversation Cache Busting With Laravel Mix.version() Not Working

Hi everybody, I just noticed that mobile chrome shows an old cached version of my page (I tried in incognito and it always returns newest version), I tried to solve this by adding Cache Control: must-revalidate and max-age="0" using a global middleware, this didn't work either.

Now since I'm using laravel-mix with my laravel/app I tried using mix.version() but this isn't working either... I checked my mix manifest file and it looks like this:

{
    "/js/app.js": "/js/app.js",
    "/css/app.css": "/css/app.css"
}

And my mix dile looks like this:

mix.js('resources/js/app.js', 'public/js')
   .sass('resources/sass/app.scss', 'public/css')
   .version();

This is how I access js file in my blade layout:

<script src="{{ mix('/js/app.js') }}"></script>
</body>

None of the mentioned solutions worked and it's geting quite depressing...

I don't want to add query string versioning myself too...

15 May
4 months ago

Gabotronix left a reply on Multiple Laravel Form Request Validation Rules In A Single File

@MUSHOOD - This does look my man but I'm not a fan of adding an input variable into my payloads just to get this to work, wuld it be possible to DI it in the controller method arguments or similar?

Thanks in advance.