carincon93

Experience

510

0 Best Reply Awards

  • Member Since 3 Weeks Ago
  • 0 Lessons Completed
  • 0 Favorites

21st April, 2018

carincon93 left a reply on How To Concatenate Index (v-for) In The 'id' Of Several Textareas And In The 'for' Attr Of The Label? • 2 days ago

Solved:

<div v-for="(n, index) in 2">
    <label for="'item'+index">Item Nro. {{ index + 1 }}</label>
    <textarea id="'item'+index" name="itemName[]" rows="8" cols="80"></textarea>
</div>

carincon93 started a new conversation How To Concatenate Index (v-for) In The 'id' Of Several Textareas And In The 'for' Attr Of The Label? • 2 days ago

I need to generate this text area with its respective id and the label with the correct 'for'

<label for="item1">Item Nro. 1</label>
<textarea id="item1" name="itemName[]" rows="8" cols="80"></textarea>

<label for="item2">Item Nro. 2</label>
<textarea id="item2" name="itemName[]" rows="8" cols="80"></textarea>

This is the v-for

<div v-for="(n, index) in 2">
    <label for="item">Item Nro. {{ index + 1 }}</label>
    <textarea id="item" name="itemName[]" rows="8" cols="80"></textarea>
</div>

16th April, 2018

carincon93 left a reply on Two Nested Foreach Duplicate Options - Select Tag • 6 days ago

@Sergiu17 your code only show the roles assigned to user, I need to show all roles selecting the assigned to user

carincon93 started a new conversation Two Nested Foreach Duplicate Options - Select Tag • 6 days ago

I need to select the options with user roles

<select class="form-control" name="role_user">
// foreach - all roles
    @foreach ($roles as $role)
// foreach - roles user
        @foreach($usuario->roles as $userRole)
        <option value="{{ $role->id }}" {{$role->id == $userRole->id ? 'selected' : ''}} >{{ $role->name }}</option>
        @endforeach

    @endforeach
</select>

The previous code shows the following duplicate options:

student student admin admin

carincon93 left a reply on Update Records In Pivot Table • 6 days ago

thanks @bobbybouwmann, I did not know the function of updateExistingPivot, I solved it with

$proyecto->semilleros()->sync($semilleros);

carincon93 started a new conversation Update Records In Pivot Table • 6 days ago

I need to update multiple record in a pivot table, but not work

Code:

<select class="form-control" name="role_user">
    @foreach ($roles as $role)
        @foreach($user->roles as $userRole)
        <option value="{{ $rol->id }}" {{$rol->id == $userRole->id ? 'selected' : ''}} >{{ $role->name }}</option>
        @endforeach
    @endforeach
</select>
// Array roles
$idRole  = $request->get('rol_user');
// Update existing pivot
foreach ($user->roles as $userRole) {
    $user->roles()->updateExistingPivot($userRole->id, ['rol_id' => $idRol]);
}

7th April, 2018

carincon93 started a new conversation Set V-bind:value Dynamically Of An Input, Using V-for • 2 weeks ago

How can I simplify that code, I need to set the v-bind-value="diff1" associates with v-model="startDate1" and v-model="endDate1", same for diff2 with dates startDate2 and endDate2.

<h1>C01</h1>
<div class="form-group">
    <label>Star Date</label>
    <input type="date" name="startDate[]" class="form-control" v-model="startDate1">
</div>
<div class="form-group">
    <label>End date</label>
    <input type="date" name="endDate[]" class="form-control" v-model="endDate1" @change="moment1(startDate1, endDate1)">
</div>
<div class="form-group">
    <label>Duration (days)</label>
    <input type="number" name="duration[]" class="form-control" readonly v-bind:value="diff1">
</div>

<h1>C02</h1>
<div class="form-group">
    <label>Start date</label>
    <input type="date" name="starDate[]" class="form-control" v-model="startDate2">
</div>
<div class="form-group">
    <label>End date</label>
    <input type="date" name="endDate[]" class="form-control" v-model="endDate2" @change="moment2(startDate2, endDate2)">
</div>
<div class="form-group">
    <label>Duration (days)</label>
    <input type="number" name="duration[]" class="form-control" readonly v-bind:value="diff2">
</div>

<script type="text/javascript">
export default {
    data: function () {
        return {
            starDate1: [],
            enDate1: [],
            diff1: [],
            startDate2: [],
            endDate2: [],
            diff2: [],
        }
    },
    methods: {
        moment1: function (starDate1, fechaFina) {
            var self = this;
            var date1 = moment(starDate1, 'YYYY/MM/DD');
            var date2 = moment(fechaFina, 'YYYY/MM/DD');
            
            self.diffa = date2.diff(date1, 'days');
        },
        moment2: function (startDate2, endDate2) {
            var self = this;
            var date1 = moment(startDateb, 'YYYY/MM/DD');
            var date2 = moment(endDateb, 'YYYY/MM/DD');
            
            self.diff2 = date2.diff(date1, 'days');
        }
    },
}
</script>


6th April, 2018

carincon93 started a new conversation Set Input Inside V-for • 2 weeks ago

I need inside that v-for set duration input with your respective diff days between start date and end date.

<div v-for="(qty, index) in 4">
    <div class="form-group">
                <label for="[object Object]">Start Date</label>
                <input type="date" name="startDate[]" class="form-control" v-model="startDate">
            </div>
            <div class="form-group">
                <label for="[object Object]">End Date</label>
                <input type="date" name="endDate[]" class="form-control" v-model="endDate" @change="moment(startDate, endDate)">
            </div>
            <div class="form-group">
                <label>Duration (days)</label>
                <input type="number" name="duration[]" class="form-control" readonly v-bind:value="diff">
    </div>
</div>

<script type="text/javascript">
export default {
    data: function () {
        return {
            startDate: [],
            endDate: [],
            diff: [],
        }
    },
    methods: {
        moment: function (startDate, endDate) {
            var self = this;
            var date1= moment(startDate, 'YYYY/MM/DD');
            var date2= moment(endDate, 'YYYY/MM/DD');

            self.diff = date2.diff(date1, 'days');
        }
    },
}
</script>

4th April, 2018

carincon93 left a reply on Input Checkboxes (checked) From Array Associative • 2 weeks ago

@Cinek thanks, and this input editar-rol was a mistake

carincon93 started a new conversation Input Checkboxes (checked) From Array Associative • 2 weeks ago

I need to checked multiple input checkbox from an array

this $rol->permisos show this array:

array:2 [▼
 "editar-usuario" => true
 "editar-rol" => true
]
@foreach ($rol->permisos as $key => $permiso)
                           <input type="checkbox" name="" value="" {{ $key == 'editar-rol' ? 'checked' : ''}}>1
                           <input type="checkbox" name="" value="" {{ $key == 'crear-rol' ? 'checked' : ''}}>2
                           <input type="checkbox" name="" value="" {{ $key == 'editar-rol' ? 'checked' : ''}}>3
@endforeach

but this code show 6 input (it multiplies the quantity items in the array)

3rd April, 2018

carincon93 started a new conversation Input Array To Associative Json • 2 weeks ago

I need generate the following json through input array:

{"crear-proyecto": true, "editar-proyecto":true}

´´´ {{ __('crear-proyecto') }} {{ __('editar-proyecto') }} ´´´

29th March, 2018

carincon93 left a reply on Dynamic Text Inside V-for • 3 weeks ago

@topvillas I need v-model="message1" write p {{ message1 }}, v-model="message2" on p {{ message2 }} ....

carincon93 started a new conversation Dynamic Text Inside V-for • 3 weeks ago

I need to create 10 input, each with a different v-model to write to the corresponding

<div v-for="(n, index) in 10">

   <input type="text" v-model="message">
   <div>
       <p>
           {{ message }}
       </p>
   </div>
   
</div>

´´´

27th March, 2018

carincon93 left a reply on [Vue - Laravel] V-for Dynamic With Input • 3 weeks ago

Solution: v-model.number

<input type="number" v-model.number="qty" @onchange="crateItems">

carincon93 started a new conversation [Vue - Laravel] V-for Dynamic With Input • 3 weeks ago

I need to make a list of items with a dynamic v-for.

In an input type number, a specific number is placed and from that number a list of html elements is built.

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.