alexpnet89

alexpnet89

Member Since 2 Years Ago

Experience Points 5,230
Experience Level 2

4,770 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 48
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.

13 Nov
1 year ago

alexpnet89 left a reply on Call Controller Method From Vue

Thank you all for the help, the @robrogers3 solution works!

11 Nov
1 year ago

alexpnet89 started a new conversation Call Controller Method From Vue

Hello. Could anybody help me?

I create a componente in vueJS where i call in a blade view, passing a collection to this component.

For each item of this collection, i create a button dinamically, where when i click in this button, i will call a controller method that will receive some parameters, and print a PDF page.

How can i do it? I've already create the button, the only thing i need to do, is call the method.

19 Oct
1 year ago

alexpnet89 left a reply on Input Required Dinamically

@matt_panton , it is returning 1 or 0, you're correct.

Thanks

alexpnet89 started a new conversation Input Required Dinamically

Hello Devs, Can you help me? I need to change an input to be required dinamically.

How can i do it? This is the way i did:

<div class="my-dynamic-form">
    <form class="form-horizontal">
        
        <div class="form-group" v-for="formItem in fields">

            <label class="col-sm-2 control-label" v-if="formItem.type != 'CheckBox'">{{formItem.name}}</label>

            <div class="col-sm-8" v-if="formItem.type == 'Text'">
                <input  type="text" :name="formItem.name" class="form-control" :required="formItem.required" v-model="formItem.value" @keyup="clearMessage()">
            </div>

            <div class="col-sm-8" v-if="formItem.tipo_dado == 'Number'">
                <input  type="number" :name="formItem.name" class="form-control" :required="formItem.required" v-model.number="formItem.value" @keyup="clearMessage()">
            </div>

            <div class="col-sm-offset-2 col-sm-8" v-if="formItem.type == 'Checkbox'">
                <input type="checkbox" :name="formItem.name" v-model="formItem.value"> {{ formItem.name }}
            </div>

        </div>
        
        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-8">
                <button type="button" class="btn btn-primary btn-block" @click="submitForm()">Save</button>
                <button type="button" class="btn btn-danger btn-block" @click="cancelar()">Cancel</button>
            </div>
        </div>
    </form>
</div>

But doesnt works. The property "required" from "fields" array, returns true or false.

15 Oct
1 year ago

alexpnet89 left a reply on Posting Data To Laravel App From VueJS

EDITED: I GET IT!!! What is doing wrong is the empty object that i've assign as "default", in the data property.

Thank you!

Hello guys, i'm almost there!! =)

Here is my submitForm method:

methods: {
            submitForm() {

                this.registros.id_atividade = 1;
                this.registros.id_user = 2;
                this.registros.id_tipo_registro = this.campos[0].id_tipo_registro;

                for (var i = 0; i < this.campos.length; i++) {

                    var obj = {};
                    obj.id_registro_campo = 1;
                    obj.valor = this.campos[i].valor;
                    obj.campo = this.campos[i].nome;

                    this.registros.registro_campos.push(obj);
                }


                axios.post('/registros', this. registros)
                    .then( response => {
                        alert('success');
                    }, error => {
                        console.log('erro');
                    });
            }
        }

What is doing totally wrong is that always the first object stays empty. My question is Why? What i 'm doing wrong to this first object of the array get empty?

alexpnet89 left a reply on Posting Data To Laravel App From VueJS

@florianhusquinet, i've watched this video, and i think i get the way to post data, but i still have doubts about how to create this data object =/

alexpnet89 started a new conversation Posting Data To Laravel App From VueJS

Hi guys, can somebody help me? I'm finishing my first app with laravel + VueJS, but with so many doubts in the way.

Right now, i have one page where i generate the form dinamically, and need to send the data to laravel, but i have no idea how to.

this is the code of my form:

<template>
    <div>
        <div class="my-dynamic-form">
            <form class="form-horizontal">
                <div class="form-group" v-for="formItem in campos">

                    <label class="col-sm-2 control-label"
                           v-if="formItem.tipo_dado == 'Texto'">
                        {{formItem.nome}}
                    </label>

                    <div class="col-sm-8"
                         v-if="formItem.tipo_dado == 'Texto'">
                        <input type="text" class="form-control" v-model="formItem.valor">
                    </div>

                    <div class="col-sm-offset-2 col-sm-8"
                         v-if="formItem.tipo_dado == 'Boolean'">
                        <input type="checkbox" v-model="formItem.valor"> {{ formItem.nome }}
                    </div>

                </div>
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-8">
                        <button type="button"
                                class="btn btn-primary btn-block"
                                @click="submitForm()">Gravar</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</template>
<style>

and this is my script:

<script>

    export default{
        props: ['campos'],
        data: function() {
            return {
                registros: {
                    id_atividade: '',
                    id_user: '',
                    id_tipo_registro: '',
                        registro_campos: [{
                            id_registro_campo: '',
                            valor: '',
                            campo: ''
                        }]
                }
            }
        },
        methods: {
            submitForm(formItem) {

                console.log(formItem);


            }
        }
    }
</script>

This is my store method on laravel:

public function store(Request $request)
    {

        foreach ($request->input('registros') as $key => $registro){

            $registroCriado = Registro::create([
                'data' => Carbon::now(),  //"2017-08-01",
                'id_atividade' => $registro['id_atividade'],
                'id_user' => $registro['id_user'],
                'id_tipo_registro' => $registro['id_tipo_registro']
            ]);

            foreach ($registro['registro_campos'] as $key => $registroCampo){

                RegistroCampo::create([
                    'id_registro' => $registroCriado->id,
                    'id_registro_campo' => $registroCampo['id_registro_campo'],
                    'valor' => $registroCampo['valor'],
                    'campo' => $registroCampo['campo']
                ]);
            }

        }

All i have to do is send my form to the laravel, where the data will be stored in the database.

How can i do that? Any Tutorials? I am on the right way?

14 Oct
1 year ago

alexpnet89 left a reply on Sending Data To Component

@MaverickChan, i tried like this, but doesnt works too =/

alexpnet89 started a new conversation Sending Data To Component

Hello guys. Can you tell me where i did wrong?

I'm sending the data to my component, but this stays undefined. Here's my code:

CreateRegistro.vue

<template>
    <div>
        <h1>Registro</h1>
        <dynamic-form :formValues="formItemsList"></dynamic-form>
    </div>
</template>


<script>

    import DinamicForm from 'DinamicForm.vue';

    export default{
        data: function() {
            return {
                formItemsList: [{
                    input_type: "text",
                    input_label: "Login",
                    values: {
                        value: "[email protected]"
                    }
                }, {
                    input_type: "checkbox",
                    input_label: "",
                    values: {
                        checked: true,
                        label: "My first checkbox"
                    }
                }, {
                    input_type: "checkbox",
                    input_label: "",
                    values: {
                        checked: false,
                        label: "My second checkbox"
                    }
                }]
            }
        },
        components: {
            dynamicForm: DinamicForm
        }
    }
</script>

DinamicForm.vue

<template>

    <div class="my-dynamic-form">
        <form class="form-horizontal">
            <div class="form-group" v-for="formItem in formValues">
                <label class="col-sm-2 control-label">{{formItem.input_label}}</label>
                <div class="col-sm-10" v-if="formItem.input_type == 'text'">
                    <input type="text" class="form-control" v-model="formItem.values.value">
                </div>

                <div class="col-sm-10" v-if="formItem.input_type == 'checkbox'">
                    <input type="checkbox" v-model="formItem.values.checked"> {{formItem.values.label}}
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                    <button type="button" class="btn btn-default" @click="submitForm()">Submit</button>
                </div>
            </div>
        </form>
    </div>
</template>


<script>

    export default {
        props: ["formValues"],
        methods: {
            submitForm() {
                console.log("Submit this form");
            }
        }

    }
</script>

The prop "FormValues" gets undefined.

13 Oct
1 year ago

alexpnet89 left a reply on Passing Data To Components

Thank you so much, works! =D

thank you for the tip too, i didnt know about the blackticks.

alexpnet89 started a new conversation Passing Data To Components

I have im my app, one array of objects, and this objects are showed in a screen like this: ''' < tr v-for="tipo in listaOrdenada"> < td @click="selected">{{ tipo.descricao }}< /td >

'''

what i need to do is, when i click in this , this object is send to other component <app-formulario :campos="lista[0].tipo_registro_campos"></app-formulario>

where lista[].tipo_registro_campos is what i need. The problem is that i'm sending the index 0 fixed, this index should be the id of the object.

How i can do this?

This is my object: { "id": "29", "descricao": "07CO Registrar Consumo", "tipo_registro_campos": [ { "id": "305", "nome": "Lote", "tipo_dado": "Texto", "tamanho": "30", "obrigatorio": false, "id_tipo_registro": "29", } ] }

11 Oct
1 year ago

alexpnet89 left a reply on Problem With Routing My Application

@alenabdula, thank tou Very much. I think was not clear for me about using vueJs inside muito laravel application, André for some reason i understand that i have to use vue router.

If course, i can let laravel take care about my routes. Now this seems obvious.

Thank tou again.

10 Oct
1 year ago

alexpnet89 left a reply on Problem With Routing My Application

what i'm trying to do is build a page in vuejs and integrate with my application tha already exists, all the pages was made in blade, except this, that i will use Vue.

This is my code: https://github.com/alexpnet89/registros

in the app.blade, i have this link:

  • Registrar
  • in this link that i have my problem. Sorry about my english

    alexpnet89 started a new conversation Problem With Routing My Application

    Hi guys, can anybody help me?

    I have a laravel application, where i put a link in the navbar, this link will show a component that i made with VueJS, and i used the vue-router to make this call and show the component to the user.

    What happens is that the path that i configured in the routes.js file, is being added in the final of the actual directory.

    For example:

    let routes = [ { path: '/register/create', component: RegisterCreate } ];

    So, in the URL http://localhost:8000/units, when i click in this link, the user is send to the address: http://localhost:8000/units/register/create, and is showed in the end of the page the component RegisterCreate.

    I don't uderstand where is my mistake.

    27 Sep
    2 years ago

    alexpnet89 started a new conversation Get The User Id In Laravel Passport

    How can i get the user id, the owner of the token sending in request? The grant type that i used was the type:password.