carincon93

Experience

740

0 Best Reply Awards

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

20th July, 2018

carincon93 left a reply on I Need To Generate A Code With A Auto-increment Number • 1 day ago

@lostdreamer_nl I found a problem, if I have 31 registered projects, the last code will be SIPRO-00032-2019, but if I delete a project, the last code will be the same SIPRO-00032-2019, I need the unique code.

8th July, 2018

carincon93 left a reply on MethodNotAllowedHttpException When I Enter The Url Of The 'ROUTE'::PUT In The Web Browser • 1 week ago

@Cronix because the resource routes are:

Route::get('/posts/create', 'PostController');
Route::post('/posts', 'PostController');

Route::get('/posts/{id}', '[email protected]');

Route::get('/posts/{id}/editar', '[email protected]');
Route::put('/posts/{id}', '[email protected]');

The post, put and destroy routes are associated with get routes. For example, if I when entering to the put route to validate that there is no error, will show me the edit view:

I would have to create a route::get to associate the route::put

Route::get('/{idProject}/send', '[email protected]')

carincon93 started a new conversation MethodNotAllowedHttpException When I Enter The Url Of The 'ROUTE'::PUT In The Web Browser • 1 week ago

This route is from an edit form and work correctly, but when I enter the url manually in the browser, I get the following error MethodNotAllowedHttpException.

I need to mask it in a 'Route::get' or how can I solve it?

Route::put('/{idProject}/send', '[email protected]')

thanks.

22nd May, 2018

carincon93 started a new conversation I Need To Generate A Code With A Auto-increment Number • 1 month ago

I need to generate a project code, with an auto-increment number, like this:

// SIPRO-00001-2018
// SIPRO-00002-2018
// SIPRO-00003-2018

But, when the year changes, the project code should be this (restart the auto-increment number):

// SIPRO-00001-2019
// SIPRO-00002-2019

My code. But when the year changes, if I have 200 projects, the code be SIPRO-00201-2019

$lastProject        =   Project::orderBy('created_at', 'desc')->first();

$project = new Project();

if (isset($lastProject)) {
    // Sum 1 + last id
            $project->code        = 'SIPRO-0000'.($lastProject->id + 1).'-'.date('Y');
        } else {
            $project->code        = 'SIPRO-00001-'.date('Y');
        }

$project->save();

10th May, 2018

carincon93 left a reply on How Pass Variable To Flash Messages Without Concatenating • 2 months ago

with double quotes

"The user {$user->name} has been added"

carincon93 started a new conversation How Pass Variable To Flash Messages Without Concatenating • 2 months ago

I need to pass a variable to a flash message, but without concatenating

return redirect()->route('users.index')
            ->with('status', 'The user ' .$user->name.' has been added');

I need something like this, it's possible?

return redirect()->route('users.index')
            ->with('status', 'The user {userName} has been added', $user->name);

24th April, 2018

carincon93 started a new conversation Print Old Data From A JSON In Multiple Textarea Into A Vue Component • 2 months ago

I have multiple textareas in a vue component, and I need to print old data from a json, in the respective textarea

Description.vue

<div v-for="(invoice, index) in qty">
    <textarea name="description[]">{{ olddata }}</textarea>
</div>

// this code show each textarea with the following data
                    {{-- [
                    "text 1",
                    "text 2",
                    "text 3",
                    "text 4"
                    ] --}}

<script type="text/javascript">
export default {
    props: ['oldata'],

    data: function () {
        return {
            qty: 4,
        }
    }
}
</script>

Pass old data to the component

<description :oldata="{{ json_encode(old('description')) }}> </description>

JSON

[
  "text 1",
  "text 2",
  "text 3",
  "text 4"
]

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? • 3 months 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? • 3 months 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 • 3 months 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 • 3 months 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 • 3 months 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 • 3 months 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 • 3 months 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 • 3 months 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 • 3 months ago

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

carincon93 started a new conversation Input Checkboxes (checked) From Array Associative • 3 months 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 • 3 months 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 months 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 months 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 months 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 months 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.