iamlux20

Web and Mobile Developer at Kaisa Consulting

Member Since 2 Years Ago

Manila

Experience Points
2,780
Total
Experience

2,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
21
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your 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-in-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 Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist 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.

  • Community Pillar

    Earned once your experience points ranks in the top 10 of all Laracasts users.

Level 1
2,780 XP
Mar
10
1 month ago
Activity icon

Replied to Add/Remove Input Fields Doesn't Store Into The Same Array Field

Only gets the first field

6:
name: "color[]"
value: "Black1"
__proto__: Object
length: 7
Activity icon

Replied to Add/Remove Input Fields Doesn't Store Into The Same Array Field

yes, there's a form in the parent of the colors div. Although I send it on a normal button click to a POST route instead of ajax sending

Mar
09
1 month ago
Activity icon

Started a new Conversation Add/Remove Input Fields Doesn't Store Into The Same Array Field

What I'm doing is to have an option of an item can have multiple colors. Problem is the dynamically added input fields doesn't save upon hitting the button.

<div class="wrapperColor">
    <label for="color">Color/s</label>
        <div class="row" style="padding: 1% 0;">
            <div class="col-9 form-group">
                <input type="text" name="color[]" class="form-control" placeholder="Black" required>
            </div>
        </div>
</div>

<button class="add_field_button btn btn-md text-dark">Add More Fields</button>

Then, for my jQuery code

$(document).ready(function() {
        var wrapper = $(".wrapperColor"); //Fields wrapper
        var add_button = $(".add_field_button"); //Add button ID
        var x = 1; //initlal text box count

        $(add_button).click(function(e) { //on add input button click
            e.preventDefault();

            x++; //text box increment

            var html = '';
            html += '<div class="row form-group" style="padding: 1% 0;">';

                html += '<div class="col-9">';
                    html += '<input type="text" name="color[]" class="form-control" placeholder="Black">';
                html += '</div>';

                html += '<div class="col-3">';
                    html += '<a href="#" class="remove_field"><i class="fas fa-times fa-lg" style="color: red;"></i></a>';
                html += '</div>';
            html += '</div>';

            $(".wrapperColor").append(html);
        });

        $(".wrapperColor").on("click", ".remove_field", function(e) {
            e.preventDefault();
            $(this).parent('div').parent('div').remove();
            x--;
        })
    });

Upon checking dd($request->all()) in the controller, it only retrieves the first item in the array (which is the base input)

"color" => array:1 [▼
    0 => "Black"
  ]
Mar
06
1 month ago
Activity icon

Replied to Changed The Way To Save A Data From String To Int After App Launch, Any Options To Retrieve Its String Equivalent?

If it's not a json, I could easily do eloquent to call $item->destination->name on the destination under an if statement (if $item->destination is a numeric), then do a one-time conversion from string to id

Mar
03
1 month ago
Activity icon

Started a new Conversation Changed The Way To Save A Data From String To Int After App Launch, Any Options To Retrieve Its String Equivalent?

So we now have a table column that's mixed up containing id numbers and strings of a cities table.

For reference:

Deliveries table

Delivery ID -------- destination

1 ---------------------- Buffalo

2 ---------------------- Syracuse

3 ---------------------- 5 (one-to-one relationship on Delivery-City models)

My issue is that since it has been changed, the JSON request we're doing also needs to update its syntax. Currently we have this:

$domesticsJson = DomesticDelivery::join('domestics', 'domestics.id', '=', 'domestic_deliveries.domestic_id')
            ->join('domestic_shipments', 'domestic_shipments.id', '=', 'domestic_deliveries.domestic_shipment_id')
            ->join('ref_cities', 'ref_cities.id', '=', 'domestic_deliveries.destination')
            ->select('domestic_shipment_id', 'domestics.customer', 'domestics.delivery_doc_num', 'domestic_shipments.type_id', 'destination', 'domestic_shipments.pod_return_date', 'domestic_shipments.status')
            ->where('domestic_shipments.status', 1)
            ->orderBy('domestic_deliveries.created_at', 'desc')
            ->get()
            ->toJson();

Trying to aim that id#3 would be converted into the name of the city instead of its id

Jan
05
3 months ago
Activity icon

Started a new Conversation Exclude Null Contents Into Request

I'm trying to do a table where there's a checkbox and a quantity count (if checked), and null contents are being sent. Is there a way to exclude that?

For reference:

<td>
    <label class="checkbox deliveryNotesLabel">
    <input type="checkbox" class="deliveryNotes" name="deliveryNotes[]" value="{{ $item->id }}"/>
        <span></span>
    </label>
</td>
<td>
    <input type="number" min="0" max="100" name="vans[]" class="form-control">
</td>

this is what $request->all() retrieves when I try to pick 2nd and 3rd items:

array:3 [▼
  "_token" => "DzGh2Q7fjhfbr4iexJ1c4AaTd8QlrA60zBphMgV7"
  "vans" => array:4 [▼
    0 => null
    1 => "1"
    2 => "2"
    3 => null
  ]
  "deliveryNotes" => array:2 [▼
    0 => "8"
    1 => "7"
  ]
]
Dec
10
4 months ago
Activity icon

Started a new Conversation Skip Unique Validation For Update()

Is there a workaround to skip validation for a variable uniqueness for update even though that variable isn't modified?

Eg:

public function update ($id, Request $req)
{
$req->validate([
            'name' => 'unique:users|required',
	    'description' => 'required'
        ]);
	// other code
}

If I've only update the description, this would throw an error that my $req->name already exists.

Nov
04
5 months ago
Activity icon

Replied to Getting The Hour Of A Created_at Time Stamp In Laravel

On query, your Carbon::now()->hour will only result to an integer of the current hour, querying created_at (or updated_at) typically uses datetime or timestamp.

$hourNow= Carbon::now()->format('Y-m-d H:00:00');
$items = Item::where('created_at', '>=', $hourNow)->get()->count();
Nov
03
5 months ago
Activity icon

Replied to Predetermined ID Number

Thanks @rodrigo.pedra and @jlrdw

Am using Hashids\Hashids to mask id number for the url of items, and needs to have an integer as input.

Although my app only has a single admin account, my next step is to have an auto-signout feature if account is logged in to another device/browser to prevent 2 admin accounts trying to use the predeterminedId and creating an error before creation.

Nov
02
5 months ago
Activity icon

Started a new Conversation Predetermined ID Number

Was wondering if Laravel can add a minor syntax to predetermine the latest ID number. To simplify this code:

$lastId = Model::select('id')->orderBy('id', 'desc')->first();
$predeterminedId = ++$lastId->id;

Oct
12
6 months ago
Activity icon

Replied to First Item On The List Doesn't Display Its Necessary <form> Tag

@sinnbeck tried, didn't work. however, i've tried to add a blank form tag and it pushed through. so the tr > td now looks like this

<tr><td> <form></form>
			
	<form method="POST" action="/mobolist/{{ $mobo->id }}/add-to-build" enctype="multipart/form-data">
		@csrf
		<input type="hidden" name="auditId" value="snipped">
		<input type="hidden" name="specsId" value="snipped">
		<button type="submit" class="btn btn-dark btn-sm">Add</button>		
									
	</form>
</td></tr>
Oct
11
6 months ago
Activity icon

Replied to First Item On The List Doesn't Display Its Necessary <form> Tag

hi @sinnbeck , those were datatables.js classes for sorting

Activity icon

Replied to Where Are You All From?

Manila, Philippines represent

Activity icon

Started a new Conversation First Item On The List Doesn't Display Its Necessary <form> Tag

All of my items/index pages have this bug where the first item of the loop doesn't have the form tag. Have no idea why or how it does that.

@foreach($mobos as $mobo)
					
<tr><td>
			
	<form method="POST" action="/mobolist/{{ $mobo->id }}/add-to-build" enctype="multipart/form-data">
		@csrf
		<input type="hidden" name="auditId" value="snipped">
		<input type="hidden" name="specsId" value="snipped">
		<button type="submit" class="btn btn-dark btn-sm">Add</button>		
									
	</form>
</td></tr>
@endforeach

dev console on browser where it doesnt display the first item https://i.stack.imgur.com/19lGF.png

however on the succeeding lines, it displays the form https://i.stack.imgur.com/pIKP6.png