Jonjie

Jonjie

Back end Developer at Philippines

Member Since 2 Years Ago

Experience Points
16,950
Total
Experience

3,050 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
125
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.

Level 4
16,950 XP
Jul
03
6 days ago
Activity icon

Replied to How To Add Laravel To Existing Angular 9 Design

@loyd Can you give me an example? Basic example is enough for me :)

Activity icon

Replied to How To Add Laravel To Existing Angular 9 Design

@deepu07 Do you have some examples on how to do it?

Jul
02
1 week ago
Activity icon

Started a new Conversation How To Add Laravel To Existing Angular 9 Design

I’m currently facing this problem to my mind.

My team already done with the design of the website using Angular 9. Now my problem is that I don’t have any background in Angular. So my question is how can I integrate or use laravel on that finished design?

Note: I’m a fullstack developer before, but I used bootstrap + laravel.

Jul
01
1 week ago
Activity icon

Replied to Sort Data Using Different Table In Laravel

@michaloravec I got the problem now. It is also returning all the data from other restaurants. But now, how can I add where when joining? I mean, just join the data where the restaurant_id is equal to 24 or some resto id.

Activity icon

Replied to Sort Data Using Different Table In Laravel

@loyd There's no order happening there. And also different setup.

Activity icon

Started a new Conversation Sort Data Using Different Table In Laravel

I'm trying to sort or order the products based on their category. But it's not affecting the output. Please see my code below.

Controller

return DB::table('products')
	->select('name')
	->Join('categories', 'categories.id','=','products.category_id')
	->orderBy('categories.sort', 'asc')
	->paginate(10);

Output

id | name | sort

1 | Soup1 | 3

2 | Soup2 | 4

3 | Soup3 | 2

4 | Soup4 | 1

Expected Output

id | name | sort

1 | Soup4 | 1

2 | Soup3 | 2

3 | Soup1 | 3

4 | Soup2 | 4

Jun
22
2 weeks ago
Activity icon

Started a new Conversation How To Format Time Data Type In Laravel

How can I format time data type in laravel? Please see my code below.

Model

protected $dates = ['start_date', 'end_date', 'show_at', 'hide_at', 'created_at', 'updated_at'];

View

{{ $promotion->show_at->format('h:i:s A') }}

Data from database (type: time)

23:59:59

Error

Unexpected data found. Unexpected data found.

Jun
05
1 month ago
Activity icon

Started a new Conversation JQuery Guillotine And Laravel

Have you guys tried to use jQuery Guillotine and combine it with laravel and save it to s3 (aws)?

I need...

  • Specific references or blog or tutorials on how to do it.

I've research over the internet but I just found a few of them using jQuery Guillotine.

Any idea about this?

Jun
01
1 month ago
Activity icon

Started a new Conversation What Happen If I Have 2 Namespace In 1 Class

I know this is a bit odd, but I'm currently editing an old project (endorsed by someone) and I've encountered this class where it has 2 namespace declared. What bothers me is I'm always thinking what is the real namespace of that class? Does it override the namespace or I can use these 2 namespaces?

<?php

namespace App\Http\Controllers;
namespace App\Http\Controllers\Admin;

class Monitoring
{

}

May
29
1 month ago
Activity icon

Started a new Conversation Mobile Authentication Error

I'm currently using this package for mobile authentication: JWT Auth, but unfortunately, after running composer install (since I'm installing new package), the login is now not working. Please see below for more details.

Warnings:

  • The current project is using md5 for password encryption.
  • Old project (endorsed to me)

Package I'm using for authentication:

JWT Auth

Problem that needs to solve:

  • After running composer install, the login is now not working. It only returns 500 error.

Screenshot of Installed packages:

Last Error logs:


[2020-05-29 19:13:46] local.ERROR: Undefined index: password {"exception":"[object] (ErrorException(code: 0): Undefined index: password at C:\wamp\www\project\vendor\laravel\framework\src\Illuminate\Auth\EloquentUserProvider.php:133)

Note:

This error only happened when I ran the command.

May
28
1 month ago
Activity icon

Replied to SESSION_SECURE_COOKIE For?

@michaloravec So in other words, it should always be true right? unless you don't want to save the cookies to the browser.

Activity icon

Replied to SESSION_SECURE_COOKIE For?

@siangboon What will happen if I set it to false?

Activity icon

Replied to SESSION_SECURE_COOKIE For?

@michaloravec What will happen if I set it to false?

Activity icon

Started a new Conversation SESSION_SECURE_COOKIE For?

Sorry for my question, but out of curiosity, what is this code for?

config/session.php

'secure' => env('SESSION_SECURE_COOKIE', true)

What will happen if I set it to false or true?

Description

    /*
    |--------------------------------------------------------------------------
    | HTTPS Only Cookies
    |--------------------------------------------------------------------------
    |
    | By setting this option to true, session cookies will only be sent back
    | to the server if the browser has a HTTPS connection. This will keep
    | the cookie from being sent to you if it can not be done securely.
    |
    */

I know that there's a description already but do you have any specific explanation for this? I just want to understand it as a whole.

May
26
1 month ago
Activity icon

Replied to AWS HTTP Error: CURL Error 60: SSL Certificate Problem

@dxladner You saved the day bro :) Thanks a lot.

Note: I'm also using windows 10, but with WAMP

May
22
1 month ago
Activity icon

Replied to Cannot Add New Package To Laravel Project

@bobbybouwmann After deleting composer.lock, then running composer install, now I'm getting this error:

Your requirements could not be resolved to an installable set of packages.

Activity icon

Replied to Cannot Add New Package To Laravel Project

@bobbybouwmann Okay. I will try it first.

Activity icon

Replied to Cannot Add New Package To Laravel Project

@bobbybouwmann Can't I just ignore those warnings and continue with the installation of the new package?

Activity icon

Replied to Cannot Add New Package To Laravel Project

@bobbybouwmann Why I do I get this error:

Your requirements could not be resolved to an installable set of packages.

Activity icon

Started a new Conversation Cannot Add New Package To Laravel Project

I'm currently working on an old project created by different developers. But when I'm adding a new package to composer.json file, it returns a lot of errors. Please see my code and screenshot below.

Package I'm trying to add

"aws/aws-sdk-php-laravel": "~3.0"

composer.json

"require": {
    "php": ">=7.0.0",
     "aceraven777/laravel-paymaya": "^1.0",
     "aloha/twilio": "^4.0",
     "fideloper/proxy": "~3.3",
     "florianv/laravel-swap": "^1.3",
     "freshbitsweb/laratables": "^1.1",
     "intervention/image": "^2.4",
     "laravel/framework": "5.5.*",
     "laravel/tinker": "~1.0",
     "laravelcollective/html": "^5.4.0",
     "maatwebsite/excel": "~2.1.0",
     "mews/captcha": "^2.2",
     "paypal/rest-api-sdk-php": "^1.13",
     "php-http/guzzle6-adapter": "^1.1",
     "php-http/message": "^1.7",
     "stevebauman/location": "^3.0",
     "tymon/jwt-auth": "dev-develop",
     "cartalyst/stripe-laravel": "2.0.*",
     "aws/aws-sdk-php-laravel": "~3.0"
    }

Errors in command prompt enter image description here

May
11
1 month ago
Activity icon

Replied to Security DB::raw() In Laravel

@jlrdw any explanation for this? :)

Activity icon

Replied to Security DB::raw() In Laravel

@drewdan Yes. I have a validation section for this.

$rules = [
	'latitude' => 'required',
	'longitude' => 'required'
];

$validator = Validator::make(request()->all(), $rules);

if($validator->fails()){
return response()->json($validator->messages());
}
Activity icon

Replied to Security DB::raw() In Laravel

@tray2 It is an API, so basically the request comes from the current latitude and longitude of the user.

Activity icon

Started a new Conversation Security DB::raw() In Laravel

Is it safe to use this kind of code?

May
03
2 months ago
Activity icon

Replied to 2 Controllers With Same Namespace In Laravel

@tray2 Got it bro. That's exactly the answer I'm looking for. Thanks.

Activity icon

Replied to 2 Controllers With Same Namespace In Laravel

I'm actually handling an old project, and they did this that's why I just want to make sure that everything is gonna be alright when I change any part of this project.

@deep88

Secondly, Dump autoload will clear the composer cache and remake the class definations(Not recommend approach though)

What do you mean by not recommend approach?

Activity icon

Replied to 2 Controllers With Same Namespace In Laravel

@jlrdw What will happen when I do that?

Activity icon

Replied to 2 Controllers With Same Namespace In Laravel

@jlrdw Okay. But do you know the reason why it is using the old one instead of the new one that I've created?

Activity icon

Started a new Conversation 2 Controllers With Same Namespace In Laravel

Hello. I'm confused with the workflow in laravel/PHP. I have 2 files with different name, but same namespace.

Files:

HomeController.php

Namespace: namespace App\Http\Controllers;

Class name: HomeController

HomeController_old.php

Namespace: namespace App\Http\Controllers;

Class name: HomeController

The problem is, it always use the old one that I've created instead of the new controller file. Any idea?

Apr
08
3 months ago
Activity icon

Awarded Best Reply on How To Return Empty Json

[SOLVED]

I just used this code:

json_decode('{}')
Activity icon

Replied to How To Return Empty Json

[SOLVED]

I just used this code:

json_decode('{}')
Activity icon

Replied to How To Return Empty Json

@drewdan already tried that, and it returns this:

"key": {
    "headers": {},
    "original": [],
    "exception": null
 }
Activity icon

Started a new Conversation How To Return Empty Json

I'm trying to return {} but when I do this (based on my research):

return json_encode([], JSON_FORCE_OBJECT);

it returns "{}" instead of {} only without the double quotes.

Any idea?

Apr
07
3 months ago
Activity icon

Replied to How To Save Item That Has Items Inside Using Eloquent

@jlrdw Thank you very much :) I really appreciate your answers, God Bless.

Apr
06
3 months ago
Activity icon

Replied to How To Save Item That Has Items Inside Using Eloquent

@jlrdw Nope. I don't know about Chewy, but what I did is added hidden field for the parent data or input to html, then whenever I click the Add Item button on a parent, it will also generate a hidden field with the exact value of the parent hidden key for the item :)

Activity icon

Replied to How To Save Item That Has Items Inside Using Eloquent

@snapey I just added the keys for items and same key for the options (parent data), save the parent first, then when looping the items, check if the key of parent from the database matches the key of the current item in the loop. Thanks for the idea :)

Activity icon

Replied to How To Save Item That Has Items Inside Using Eloquent

@jlrdw What do you mean by:

the select option will be passed as an array, which will hold only the selected items. ?

I don't have any problem with the select options. My problem is when I loop all the options (which is the parent data), and then loop the items (the child data) INSIDE the option loop, how do I know that the item should stop looping and proceed the rest OF THE items TO THE other options? Sorry for the confusion.

Activity icon

Replied to How To Save Item That Has Items Inside Using Eloquent

@artcore Where would I get the $id = pdo->getLastInsertedId();?

Activity icon

Replied to How To Save Item That Has Items Inside Using Eloquent

@snapey

just loop over the options, saving each. Whats the issue? Create the Item, get its Id Save each option, giving them the id of the item.

How can I loop it? I mean if I loop the options, then loop the items inside the option, all the items will also be saved for all the options.

Activity icon

Replied to How To Save Item That Has Items Inside Using Eloquent

@snapey

Can option_item belong to many options?

No, option_item should only belongs to one option.

My problem is when I save the data. All the option_items also saves to other options which is wrong. The option_items should only belongs to their right option.

Additional info: All option_items has the same name in html. So...

<input type="text" name="option_item_name[]" class="input-sm form-control">
<input type="text" name="option_item_price[]" class="input-sm form-control">

So if I loop those items, it will be save to the other options too. Sorry for the confusion. Please see the screenshot of the design above, and the html code.

Activity icon

Replied to How To Save Item That Has Items Inside Using Eloquent

@jlrdw I already know about that. But, how do you save the option_item to it's right option? Please see the screenshot for the structure. The example there is only saving many comments to 1 post. And even if you save comments to multiple post, how the comments know that they are belong to the right post?

Apr
05
3 months ago
Activity icon

Replied to How To Save Item That Has Items Inside Using Eloquent

@jlrdw No. Any explanation about that? Or link maybe.

Activity icon

Started a new Conversation How To Save Item That Has Items Inside Using Eloquent

Hi guys, hope you're doing good and safe :)

I'm just thinking how do you guys save this kind of setup using eloquent.

I have a main table called product, then a product hasMany() options, then every option hasMany() option_items. Please see my screenshot below for my design draft and code.

Screenshot:

Code


<div class="row option-row">
	<div class="col-md-6">
		<div class="panel panel-default option-panel">
			<div class="panel-heading">
				<input type="text" name="option_name[]" class="form-control white-background" placeholder="Product Option Name (e.g. Add-on Sides or Add-on Desserts)">
			</div>
			<div class="panel-body">
				<div class="form-group{{ ($errors->has('required')) ? ' has-error' : '' }}" style="margin-left: 0; margin-right: 0;">
					<label class="control-label">Required?</label>
					<select name="option_required[]" class="form-control">
						@foreach([1 => 'Yes', 2 => 'No'] as $key => $required_value)
							<option value="{{ $key }}">{{ $required_value }}</option>
						@endforeach
					</select>
					@if($errors->has('required'))
						<span class="help-block">{{ $errors->first('required') }}</span>
					@endif
				</div>

				<div class="table-responsive">
					<table class="table">
						<thead>
							<tr>
								<th>Item Name</th>
								<th>Item Price</th>
								<th>Action</th>
							</tr>
						</thead>
						<tbody>
							<tr class="item-row">
								<td>
									<input type="text" name="option_item_name[]" class="input-sm form-control" title="Example: 1-Cup Ice Cream">
								</td>
								<td>
									<input type="text" name="option_item_price[]" class="input-sm form-control" title="Example: 5.00">
								</td>
								<td>
									<span class="btn btn-danger btn-sm delete-option-item" title="Remove">&times;</span>
								</td>
							</tr>
						</tbody>
					</table>

					<span class="btn btn-info btn-ms add-option-item">Add Item</span>
					<span class="btn btn-danger delete-option">Delete Option</span>
				</div>
			</div>
		</div>

		<span class="btn btn-default" id="addOption">Add Option</span>
	</div>
</div>

Pseudo code:


foreach(request('option_name') as $option_name){
	$option = Option::create(...)

	foreach(request('option_item_name') as $option_item_name){
		$option_item = OptionItem::create(..);

		$option_item->option->attach($option);
	}
}

Problem

  • When I save the option_items, how do I know that it belongs to their option? I mean when I save it, the items also saves to other options.
Apr
02
3 months ago
Mar
31
3 months ago
Activity icon

Started a new Conversation How To Get Current Location As Text Using Google Map And Laravel

How to get current location as text using google map and laravel?

I just want the text format of the current location.

I tried this link with the provided example but It's indicated how to get the exact location as text.

https://developers.google.com/maps/documentation/javascript/geolocation

JSFiddle: https://jsfiddle.net/8xnawk3t/

Any Idea?

Mar
20
3 months ago
Activity icon

Replied to Setup In Ubuntu Only Shows Index.php As Text

@siangboon No. It really showing the php code. no error is showing.

Activity icon

Replied to Setup In Ubuntu Only Shows Index.php As Text

@camilovietnam what do you mean by version 6.0?

Activity icon

Replied to Setup In Ubuntu Only Shows Index.php As Text

@maverickchan I'll try your suggestion. thanks