jonjie

jonjie

Software Developer at Laguna

Member Since 1 Year Ago

Laguna

Experience Points
14,430
Total
Experience

570 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
120
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 3
14,430 XP
18 Sep
2 days ago

jonjie left a reply on Adding Last_signedin For Users Table

@willvincent Thanks for your advice bro.

17 Sep
3 days ago

jonjie left a reply on 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.

jonjie left a reply on 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('/');
    }
}

jonjie left a reply on 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
{

jonjie left a reply on Adding Last_signedin For Users Table

But I don't have LoginController.

jonjie left a reply on 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.

jonjie 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:

16 Sep
4 days ago

jonjie left a reply on 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.

02 Sep
2 weeks ago

jonjie left a reply on Best Anti-spam Security

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

01 Sep
2 weeks ago

jonjie left a reply on 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.

29 Aug
3 weeks ago

jonjie left a reply on Best Anti-spam Security

@jlrdw Thanks :)

28 Aug
3 weeks ago

jonjie 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.

jonjie left a reply on Implicit Controllers?

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

07 Aug
1 month ago

jonjie left a reply on 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 :)

06 Aug
1 month ago

jonjie left a reply on 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

04 Aug
1 month ago

jonjie left a reply on How To Remove Data Where The Child Table That Has Less Than 1 Value In Laravel 4

@jlrdw is there any laravel way to do this stuff? (I'm using v4.2).

jonjie started a new conversation How To Remove Data Where The Child Table That Has Less Than 1 Value In Laravel 4

I'm trying to remove all data in my query where if you less the 2 columns in its child table, if the result value is less than 1 then remove it. Please see my code below.

Parent::whereHas('Child', function($query){
  return $query->where('status', 2)->where(if ((column1 - column2) > 0) then return it);
});

Please ask me if this is not clear for you.

10 Jul
2 months ago

jonjie commented on Pizza Time

I really like the animation :) Easier to understand.

16 Apr
5 months ago

jonjie left a reply on Modify Email "from" In Laravel 5.1

@dipakrataniagile Thanks for the information bro. Anyways, what would you recommend, using third party or not? Since most of them in order to use their service, you have to pay for it. huhu

jonjie left a reply on Modify Email "from" In Laravel 5.1

@dipakrataniagile @bobbybouwmann Have you tried it without third party, like you just follow the instruction here? https://support.google.com/mail/answer/22370?hl=en

15 Apr
5 months ago

jonjie left a reply on Modify Email "from" In Laravel 5.1

@BOBBYBOUWMANN - Yep, really odd. I'm using version 5.1.46. I found a link regarding gmail, maybe this is the reason why. Have you tried this before bro?

Link: https://support.google.com/mail/answer/22370?hl=en

14 Apr
5 months ago

jonjie left a reply on Modify Email "from" In Laravel 5.1

@BOBBYBOUWMANN - Sorry for the late reply. I tried to set the global in config/mail.php to null but still getting the same result. uhmm

12 Apr
5 months ago

jonjie started a new conversation Modify Email "from" In Laravel 5.1

What if I want to use different email addresses depending on the relatedness of the form.

For example, I want to use [email protected] for my contact form. Then I want to use [email protected] for my registration form. How can I implement this?

I've already tried to use the from method but didn't work. Please see my code below.

Mail::later(10,
    [],
    compact('inputs'),
    function($m) use ($email, $inputs){
        $m->from('[email protected]', 'Name');
        $m->to($email)->subject($inputs['subject']);
    }
);
28 Feb
6 months ago

jonjie left a reply on Laravel 5.1 Vs 5.5 In 2019

@snapey Do you have more explanation about this? I'm really confuse between "As long as it is working, you don't have to upgrade" and "Upgrade it for more features, and to support the laravel community".

I'm currently working with laravel4.2 with my project, and I don't know if it is necessary to upgrade. This project is a huge one so I really don't know which way I should go. I'm also planning to build one after this, so I don't know which version to use.

Thanks @snapey

jonjie left a reply on Laravel 5.1 Vs 5.5 In 2019

Hi @snapey . Because it's not LTS version :) Any thoughts about this?

21 Feb
6 months ago

jonjie left a reply on What Are The Contracts For User Model For?

@bobbybouwmann Yeah that's more clearer. But, is it necessary to have those 3 contracts?

20 Feb
7 months ago

jonjie started a new conversation What Are The Contracts For User Model For?

I'm trying to trace these interfaces in User model but I'm really confused where did they use these interfaces inside of User model. Please see the code below:

<?php

namespace App\Models;

use Illuminate\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Foundation\Auth\Access\Authorizable;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;

class User extends Model implements AuthenticatableContract,
                                    AuthorizableContract,
                                    CanResetPasswordContract
{
    use Authenticatable, Authorizable, CanResetPassword;

    protected $table = 'users';

    protected $fillable = ['email', 'password'];
}

Screenshot: https://imgur.com/a/1nuXMeb

Any idea for this?

03 Feb
7 months ago

jonjie started a new conversation Laravel 5.1 Vs 5.5 In 2019

Hi guys :)

Any recommendations for laravel version I should use to create my new project this year (2019)? I'm planning to create a medium project. A website like a semi-CMS where the admin can update the content of the website.

5.1 or 5.5?

Thanks.

03 Jan
8 months ago

jonjie left a reply on Laravel With Html2canvas Not Saving The Picture

@S4MUEL - I'm using laravel version 4.2; Any link for this version?

27 Dec
8 months ago

jonjie left a reply on Laravel With Html2canvas Not Saving The Picture

@S4MUEL - You saved the day man. One more thing, what if I want to save it inside of public/dashboard-img?

jonjie started a new conversation Laravel With Html2canvas Not Saving The Picture

I'm trying to use html2canvas and laravel. But when I click the Save Report button, the picture is not saving. I'm also not getting any error. Please see my code below.

index.blade.php

<body>
   <div class="container">
       <div class="content">
           <div class="title">Laravel 5</div>
           <p class="paragraph">
             Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quia, veritatis dolores dicta at atque nobis maxime ea explicabo facilis molestiae voluptatibus nam nesciunt necessitatibus placeat ducimus magni nihil pariatur eligendi. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Fuga adipisci magnam in. Earum, nihil, expedita, blanditiis, iste ipsam amet obcaecati culpa ad quod itaque esse facere veritatis ratione ipsum quis.
           </p>
           <p class="paragraph">
             Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quia, veritatis dolores dicta at atque nobis maxime ea explicabo facilis molestiae voluptatibus nam nesciunt necessitatibus placeat ducimus magni nihil pariatur eligendi.
            </p>
       </div>
            
        <button id="saveReport">Save Report</button>
    </div>
        
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.4.1/html2canvas.min.js"></script>
    <script src="{{ asset('js/app.js') }}"></script>
</body>

app.js

$(document).ready(function(){
    
    var element = $('.content');
    
    $('#saveReport').on('click', function(){
        html2canvas(element, {
            background: '#ffffff',
            onrendered: function(canvas){
                var imgData = canvas.toDataURL('image/jpeg');
                $.ajax({
                    url: 'save-dashboard-report',
                    type: 'post',
                    dataType: 'text',
                    data: {
                        base64data: imgData
                    }
                });
                alert('Success!');
                console.log(imgData);
            }
        });
    });
    
});

controller

public function save(){
        
    $data = $_REQUEST['base64data'];
    $image = explode('base64', $data);
    file_put_contents('1.jpg', base64_decode($image[1]));
        
}

routes

Route::post('save-dashboard-report', '[email protected]');
17 Dec
9 months ago

jonjie started a new conversation How To Use WhereHas Inside Of Where?

I'm using laravel v4.2 here. My code returns empty when I'm using it. Please see my code below.

$result = [];

        $targets = CustomerTargetsItem::where('delivery_date', '=', date_format(Carbon::today(), 'm/d/Y'))
        ->whereHas('customerTarget', function($query){
            return $query->where('category_slug', 'scheduled_delivery_of_repaired_t12_48x48_and_euro');
        })
        ->where(function($query){
            return $query->whereHas('replacement', function($query){
                    return $query->where('status', 3)
                    ->whereDate('created_at', '=', Carbon::today());
                })
                ->orWhereHas('transfer', function($query){
                    return $query->where('status', 3)
                        ->whereDate('created_at', '=', Carbon::today());
                });
        })
        ->groupBy('customer_id')
        ->orderBy('delivery_date', 'asc')
        ->select(['customer_id', DB::raw('sum(quantity) AS total')])
        ->get();
        
        foreach($targets as $target){
            $result[] = $target->total;
        }

        dd($result);

Any idea about this?

28 Nov
9 months ago

jonjie left a reply on Get Record Of The Item Before Specific Date

@burlresearch I added an image in SO. Please check that out. THanks

jonjie left a reply on Get Record Of The Item Before Specific Date

Sorry for the confusion. What I want is the quantity/data before the date that has no quantity/data.

jonjie left a reply on Get Record Of The Item Before Specific Date

Hi @burlresearch . THanks for the quick response. Any explanation with your anwer? You might also want to check my stackoverflow question.

jonjie started a new conversation Get Record Of The Item Before Specific Date

How to get a previous record or data using the specific date?

Example: If I have a data from Nov 20 - 23, I want the data of Nov 19 (which is Monday) to be the the last data before it. So ...

Previous Dates: ['Nov 8', 'Nov 9', 'Nov 14', 'Nov 15', 'Nov 16']

Previous Data: [11, 20, 30, 13, 15]

Dates: ['Nov 19', 'Nov 20', 'Nov 21', 'Nov 22', 'Nov 23']

Data: [15, 18, 10, 20, 32]

The 15 in Data should be the previous record.

Support Reference (Stackoverflow):

https://stackoverflow.com/questions/53514466/how-to-get-data-from-previous-record-in-laravel/53516509#53516509

07 Nov
10 months ago

jonjie left a reply on Please Bring Back The Older Laracasts Design

@JEFFREYWAY - Hahahaha! Just like what you said in your other videos and your new podcast :D ... Anyways Jeff, I really love the new look of laracasts, it is really really cool! <3 Keep it up :)

20 Sep
1 year ago

jonjie left a reply on How To Use Queue Using Database As Driver

Uhm .. May I ask what driver you're using personally? And may I ask why? Sorry for lots of follow-up questions :)

jonjie left a reply on How To Use Queue Using Database As Driver

Alright, nice. Is redis free? any tutorials for redis + laravel email?

jonjie left a reply on How To Use Queue Using Database As Driver

@Mithrandir . Any downside using database as queue driver?

jonjie left a reply on How To Use Queue Using Database As Driver

Thanks for the answer Mithrandir. For #2., It's database driver specifically.

19 Sep
1 year ago

jonjie started a new conversation How To Use Queue Using Database As Driver

I have some questions regarding queues in laravel.

  1. Is it fine to use database as driver for email queuing in live site?
  2. Do you know some tutorials for this?
  3. If I use queue feature, I should run php artisan queue:listen or php artisan queue:work --daemon from my local machine. How about in live website, how can I integrate this?

Note: I'm using laravel v5.1 for this.

18 Sep
1 year ago

jonjie left a reply on Free And Best Practice For Sending Bulk Email Messages?

Alright. I get it. Thanks for your help @MikeRees and @Cronix :)

jonjie left a reply on Free And Best Practice For Sending Bulk Email Messages?

Hi @MikeRees . It means if I have 333 users, and send daily email, I can only send 1 email per day for the 333 users?

jonjie started a new conversation Free And Best Practice For Sending Bulk Email Messages?

Any suggestion for best practice on how to send email and free as well? I've read this post: https://laracasts.com/discuss/channels/laravel/best-practice-for-mass-group-emailing?page=1 regarding the best practice but I think I have to use some kind of third party to make it possible. Do you have any recommendation about this without any extra fees?

17 Sep
1 year ago

jonjie left a reply on Validation Under Array Validation

@NOMGUY . Hi, any explanation?

jonjie left a reply on Validation Under Array Validation

Hi @tykus . I think this won't work. I'm using laravel 5.1 version.

jonjie started a new conversation Validation Under Array Validation

If I have an array validation rule, how can I check if all the items in the array is a valid email? I'm using this: https://laravel.com/docs/5.1/validation#rule-array for the array validation rule.

$this->validate($request, [
    'email' => 'required|array.email'
]);

Note: I'm using laravel 5.1 version