Jonjie

Jonjie

Software Developer at Laguna

Member Since 2 Years Ago

Laguna

Experience Points
15,310
Total
Experience

4,690 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
122
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.

Level 4
15,310 XP
Dec
09
1 month ago
Activity icon

Replied to How To Work With Database For Subscription

@mvd Thanks bro, I get the idea.

Activity icon

Replied to How To Work With Database For Subscription

@tisuchi Thanks bro, but I'm using PayPal for the subscription. And this subscription is per class, not per person.

Activity icon

Replied to How To Work With Database For Subscription

@mvd Do you have any documentation for this?

Dec
08
1 month ago
Activity icon

Started a new Conversation How To Work With Database For Subscription

Hi guys. I'm currently developing a functionality where the user can subscribe to a specific class for a school. Now, what I'm confusing with, is the database structure because I'm thinking how can I add the functionality if the user wants to extend the subscription. Please see my database structure below.

If the user still have time for the subscription and wants to extend, the time should be added in subscription_ends_at field.

Or maybe I should use another table for subscription extension?

Nov
27
1 month ago
Activity icon

Replied to Timezone Matters For Subscription Time?

Thanks for your thoughts @siangboon :) I am thinking how Jeffrey handles subscription expiry dates for his users. Uhm

Activity icon

Replied to Timezone Matters For Subscription Time?

Hi @tisuchi. I already have subscription_ends_at and subscribed_at field in the database. May I know what do you prefer from the 2 options you gave, and why?

Activity icon

Started a new Conversation Timezone Matters For Subscription Time?

Hey guys! Just thinking if timezone matters for the subscription time of the users?

If the user subscribed in the US at November 27, 2019 09:56:52, what would be the result if the server is in ASIA? Is it 2019-11-27 09:56:52? or different?

BTW, I'm using Laravel v5.1.

Nov
26
1 month ago
Activity icon

Commented on Step 1: Get PHP Installed

You probably need to take some rest. And then while doing that, listen to this podcast by Jeff.

Nov
19
2 months ago
Activity icon

Replied to Account Subscription With Existing Data

@cronix Okay then. Do you also have an idea on how can I notify the user using email when their subscription expires without user interaction?

Nov
17
2 months ago
Activity icon

Replied to Account Subscription With Existing Data

@cronix What if I want to switch with PayPal?

Activity icon

Started a new Conversation Account Subscription With Existing Data

Hi. I'm currently planning to add subscriptions for my class that I have created; like laracasts where you can add a subscription to your account to access all the content. But the difference is, for me, YOU NEED TO SUBSCRIBE TO EACH CLASS TO HAVE ACCESS. Now, my problem is, I currently have classes created and don't know how to add the subscription part.

I'm gonna use PayPal/Stripe for the payment, By the way.

Laravel version: v5.1

Thanks a lot in advance.

Oct
24
2 months ago
Activity icon

Replied to Call To Undefined Function Collect()

I got it now.

Solution:

import the class like so: use Illuminate\Support\Collection;, and then,

(new Collection(Input::get('size')))->chunk(4);
Activity icon

Replied to Call To Undefined Function Collect()

@nakov uhm. But the api have this Collection class. Can we use it to get the exact resutl of collect() helper?

API: https://laravel.com/api/4.2/Illuminate/Support/Collection.html

Activity icon

Started a new Conversation Call To Undefined Function Collect()

I got this error when I tried to use the helper function collect().

collect(Input::get('size'))->chunk(4);

I'm using laravel 4.2 version.

Activity icon

Replied to Saving Parents With Their Items

@tykus Would this continue with the next parent? I mean, chunk(4) getting the first 4; would this continue with the next 4 children?

... And, I got an error:

Call to undefined function collect()

Activity icon

Replied to Saving Parents With Their Items

@tykus By the way, I'm using laravel 4.2 version.

Activity icon

Replied to Saving Parents With Their Items

@tykus How about this one that you wrote a while ago?

$parents = Input::get('items');
$children = collect(Input::get('sizes'))
    ->chunk(4)
    ->each(function ($chunk, $index) use ($parents) {
        $parent = Parent::create(['preperty' => $parents[$index]]); // replace 'property' with attribute
        $chunk->each(function ($child) use ($parent) {
            $parent->children()->create([ /* attributes on $child */ ]);
        });
    });

Would this continue with the next parent? I mean, chunk(4) getting the first 4; would this continue with the next 4 children?

Activity icon

Replied to Saving Parents With Their Items

@tykus What would be the next step after this markup?

BTW, all the rows will be generated using javascript. I didn't loop it.

Activity icon

Replied to Saving Parents With Their Items

@tykus Please see the screenshot below.

Activity icon

Replied to Saving Parents With Their Items

@tykus Nice and really bright idea. But, what if the second parent has only 3 children?

Activity icon

Started a new Conversation Saving Parents With Their Items

How can I save the items according to their specified parent data? Please see the screenshot below and code.

Screenshot:

Pseudo Code:


$parents = Input::get('items');
$children = Input::get('sizes');

foreach($parents as $parent){
    Parent::create([]);

    foreach($children as $child){
        Child::create([data here with parent id]);
    }
}

... But obviously, with that code, all children will only be saved for the first parent data since it will loop all the child data.

Example of output data when returning with Response::json();:

{"item": ["Item1", "Item2"],
"type": ["block", "plain"],
"quantity": ["75", "302"],
"equivalent": ["1", "1", "1", "1", "4", "20", "0", "4"],
"quantity": ["1", "2", "3", "4", "5", "6", "7", "8"]}

Laravel version: 4.2

Oct
16
3 months ago
Activity icon

Replied to Validation In Laravel

uhm is there any difference with your answers @bobbybouwmann and @sinnbeck ?

Activity icon

Started a new Conversation Validation In Laravel

I just want to add the operators for the validation using regex in laravel. Please see my code below.

$this->validate($request, [
    'formula' => 'regex:/^[0-9]+$/'
]);

How can I also allow operators; +, -, *, and /?

Oct
15
3 months ago
Activity icon

Replied to Can't Get Migration To Work ?

I know this is a late answer, but probably this would solve your issue.

  1. Go to app/storage/migrations.
  2. Delete the migration file that causes the error (You can also delete everything stored there).
  3. Done.
Oct
07
3 months ago
Activity icon

Replied to View Render Returns Undefined Variable

@sti3bas @jaytee @nakov @munazzil @resin @tanveerkhanwd Please see my updates above guys. Thank you very much.

Activity icon

Replied to View Render Returns Undefined Variable

@resin No. Still the same hash. uhm

Activity icon

Replied to View Render Returns Undefined Variable

@munazzil I have middleware auth in my routes.php like so:

Route::get('user/edit', ['middleware' => ['auth']]);

Activity icon

Replied to View Render Returns Undefined Variable

@nakov Nothing's changed.

Activity icon

Replied to View Render Returns Undefined Variable

@sti3bas

33: ...
34: <h1>{{ $user->username }}</h1>
35: ...
Activity icon

Replied to View Render Returns Undefined Variable

@jaytee No. I want it to return as a string, as well as I can pass a variable to it because I don't want to return a very long html code.

Activity icon

Replied to View Render Returns Undefined Variable

@sti3bas

ErrorException in b3cba3bc6b8a0eda0f3a3623998c8672 line 34: Undefined variable: user
Activity icon

Replied to View Render Returns Undefined Variable

@sti3bas Sorry I forgot to add that. Yes, it is before the view. Please see the update.

Activity icon

Started a new Conversation View Render Returns Undefined Variable

I'm trying to return a specific view's content, but it returns an undefined variable error. Please see my code below:

getEditUser() method in UserController:

$user = auth()->user();
$html = view('users.edit', compact('user'))->render();
return $html;

routes.php

Route::get('user-edit', [
        'as' => 'user.edit',
        'uses' => '[email protected]',
        'middleware' => ['auth']
    ]);

edit view (Not full code, but the rest of code is just pure html. Just rubbish code.)

33: ...
34: <h1>{{ $user->username }}</h1>
35: ...

Any idea?

P.S. I know how to return a view. But what I want is to return the content of the view as html and also able to access a variable. I also tried php artisan view:clear but still no luck.

Sep
18
4 months ago
Activity icon

Replied to Adding Last_signedin For Users Table

@willvincent Thanks for your advice bro.

Sep
17
4 months ago
Activity icon

Replied to Adding Last_signedin For Users Table

I know that way. But, I think that is not the best practice. What if for some reason, you have a different login method then you have to add it, again and again. That's why I want to follow the link I've mentioned above.

Activity icon

Replied to Adding Last_signedin For Users Table

Login method:

public function postSignin()
{
    $requirements = [
        'email' => request('email'),
        'password' => request('password'),
        'activated' => 1
    ];

    if(auth()->attempt($requirements, request('remember')))
    {
         return redirect('/');
    }
}
Activity icon

Replied to Adding Last_signedin For Users Table

I created my own controller.

<?php

namespace Modules\GeneralModule\Http\Controllers;

use Auth;
use Modules\GeneralModule\Models\User;
use Connecty\Http\Controllers\Controller;
use Modules\GeneralModule\Models\Country;

class UserController extends Controller
{
Activity icon

Replied to Adding Last_signedin For Users Table

But I don't have LoginController.

Activity icon

Replied to Adding Last_signedin For Users Table

Hi @sti3bas. Basically, I'm following the tutorial I've mentioned above. And, should I have to use that trait inside my User model? Since the default setup is that the AuthenticatesUsers trait is not included. Also, the method authenticated is not available on that trait.

Activity icon

Started a new Conversation Adding Last_signedin For Users Table

I'm following this tutorial: https://laraveldaily.com/save-users-last-login-time-ip-address/ , but I got stuck with the part where there is AuthenticatesUsers trait. I don't think this is available for laravel v5.1. Any idea for this?

Screenshot:

Sep
16
4 months ago
Activity icon

Replied to Update Password And Check For Current Password

I know this answer is late, but this is one of the options.

You can use password_verify of PHP like so:


<?php
$hash = 'y$BCryptRequires22Chrcte/VlQH0piJtjXl.0t1XkA8pw9dMXTpOq';

if (password_verify('rasmuslerdorf', $hash)) {
    echo 'Password is valid!';
} else {
    echo 'Invalid password.';
}

Check this link for reference: https://www.php.net/manual/en/function.password-verify.php.

Sep
02
4 months ago
Activity icon

Replied to Best Anti-spam Security

@jlrdw I get the idea for the honey pot. Thanks :)

Sep
01
4 months ago
Activity icon

Replied to Best Anti-spam Security

Hi @markus.heb. As per the documentation (https://github.com/spatie/laravel-honeypot/issues/12), they don't support older versions of laravel. I'm currently using L5.1 by the way.

Aug
29
4 months ago
Activity icon

Replied to Best Anti-spam Security

@jlrdw Thanks :)

Aug
28
4 months ago
Activity icon

Started a new Conversation Best Anti-spam Security

Hey guys. May I know what anti-spam security you're using and why you're using it?

I'm currently using Google's Recaptcha, but I don't have any idea if this is the best option in terms of form security.

Activity icon

Replied to Implicit Controllers?

@bobbybouwmann Thanks for your amazing explanation. It is now clear to me.

Aug
07
5 months ago
Activity icon

Replied to How To Remove Data Where The Child Table That Has Less Than 1 Value In Laravel 4

@willvincent It works bro. I didn't know there's functionality like this exists. Thanks :)

Aug
06
5 months ago
Activity icon

Replied to How To Remove Data Where The Child Table That Has Less Than 1 Value In Laravel 4

@willvincent Thanks for your reply bro. Sorry for the confusion, but I actually want to remove the child, not deleting it. I want it to be excluded from the list.

I tried your code whereRaw('column1 - column2', '>', 0), but it returns an error.

Error:

Argument 2 passed to Illuminate\Database\Query\Builder::whereRaw() must be of the type array, string given