jonjie

jonjie

Member Since 1 Year Ago

Laguna

Software Developer at Laguna

Experience Points 12,980
Experience Level 3

2,020 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 109
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

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

22 Apr
3 weeks ago

jonjie left a reply on Redirect To Login In Ajax Request If Token Expires

This is great for laravel 5. How about laravel 4.2? Do you have any suggestion for this?

16 Apr
1 month 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
1 month 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 sir?

14 Apr
1 month 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
1 month ago

jonjie started a new conversation Modify 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
2 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 is 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 should I use.

Thanks @sna

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
2 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
2 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 screenshot below:

Any idea for this?

03 Feb
3 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
4 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
4 months ago

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

@S4MUEL - You saved the day man :)

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
5 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);

28 Nov
5 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?

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

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.

07 Nov
6 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 :D ... Anyways Jeff, I really love the new look of laracasts, it is really really cool! <3 Keep it up :)

20 Sep
7 months 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 a lot 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
8 months 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?

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

18 Sep
8 months 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
8 months 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'
]);
12 Sep
8 months ago

jonjie started a new conversation No Returned Phone Number In PayPal API

I checked the data return from paypal using dd() in laravel, but there is no phone number listed there. How can I get that data?

I'm using this package: https://github.com/paypal/PayPal-PHP-SDK

Please look at this StackOverflow link for more details: https://stackoverflow.com/questions/52196026/no-returned-phone-number-in-paypal-api

04 Sep
8 months ago

jonjie left a reply on Login Will Not Log User In Although All Credentials Are Correct.

Have you try this one?

use Illuminate\Contracts\Auth\Authenticatable

class User extends Authenticatable implements Authenticatable{

jonjie left a reply on How To Check If Uploaded Image Has A Watermark?

I think there's no solution with this. Since it is on front end part, though there is something around the internet to use, you cannot check if it is 100% accurate. @Cronix is correct.

jonjie left a reply on Other Way On Logging Out Specific User?

I think Auth is using session. So, you cannot do that, unless add some field in your users table.

03 Jul
10 months ago

jonjie started a new conversation PayPal API With Laravel - Getting The Data

I'm trying to implement the API of paypal payment with laravel 5.1. But when I login in paypal (sandbox), it uses the address I used in my account, and also it uses the name from paypal account not the data from my website. That's my problem.

I want to use the data from my website because it doesn't make sense if I enter the shipping address (for example) from my website and not using it. Please see my code below for reference (Or comment down below for some details from me).

class PaypalPaymentController extends BaseController
{

    private $_api_context;

    public function __construct(){
        $paypal_conf = \Config::get('paypal');

        $this->_api_context = new ApiContext(new OAuthTokenCredential(
            $paypal_conf['client_id'],
            $paypal_conf['secret']
        ));

        $this->_api_context->setConfig($paypal_conf['settings']);
    }

    public function payWithPaypal(Request $request){
        $payer = new Payer;
        $payer->setPaymentMethod('paypal');

        $price = 0;

        switch($request->get('amount')) {
            case '10 books':
                $price = 6200;
                break;
            case '20 books':
                $price = 12200;
                break;
            case '50 books':
                $price = 25200;
                break;
            default:
                return redirect()
                        ->route('bookstore.shipping')
                        ->with('danger', 'Please select the right amount of book/s.');
                break;
        }

        $item1 = new Item();
        $item1->setName($request->get('amount'))
                ->setCurrency('PHP')
                ->setQuantity(1)
                ->setPrice($price);

        $item_list = new ItemList();
        $item_list->setItems([$item1]);

        $amount = new Amount();
        $amount->setCurrency('PHP')
                ->setTotal($price);

        $transaction = new Transaction();
        $transaction->setAmount($amount)
                    ->setItemList($item_list)
                    ->setDescription('Books transaction');

        $redirect_urls = new RedirectUrls();
        $redirect_urls->setReturnUrl(route('bookstore.payment-status'))
                        ->setCancelUrl(route('bookstore.payment-status'));

        $payment = new Payment();
        $payment->setIntent('Sale')
                ->setPayer($payer)
                ->setRedirectUrls($redirect_urls)
                ->setTransactions([$transaction]);

        try{
            $payment->create($this->_api_context);
        } catch(\Palpal\Exception\PPConnectionException $e){
            if(\Config::get('app.debug')){
                return redirect()
                        ->route('bookstore.shipping')
                        ->with('danger', 'Connection Timeout.');
            }

            return redirect()
                    ->route('bookstore.shipping')
                    ->with('danger', 'Some error occured, sorry for the inconvenience.');
        }

        foreach($payment->getLinks() as $link){
            if($link->getRel() == 'approval_url'){
                $redirect_url = $link->getHref();
                break;
            }
        }

        Session::put('paypal_payment_id', $payment->getId());

        if(isset($redirect_url)){
            return Redirect::away($redirect_url);
        }

        return redirect()
                ->route('bookstore.shipping')
                ->with('danger', 'Unknown error occured.');
    }

    public function getPaymentStatus(){
        $payment_id = Session::get('paypal_payment_id');
        Session::forget('paypal_payment_id');

        if(empty(Input::get('PayerID')) || empty(Input::get('token'))){
            return redirect()
                    ->route('bookstore.shipping')
                    ->with('danger', 'Payment failed.');
        }

        $payment = Payment::get($payment_id, $this->_api_context);
        $execution = new PaymentExecution();
        $execution->setPayerId(Input::get('PayerID'));

        $result = $payment->execute($execution, $this->_api_context);

        if($result->getState() == 'approved'){
            // Send Email
            $email_data = [
                'number_of_books' => $payment->transactions[0]->item_list->items[0]->name,
                'shipping' => [
                    'street' => $payment->payer->payer_info->shipping_address->line1,
                    'city' => $payment->payer->payer_info->shipping_address->city,
                    'state' => $payment->payer->payer_info->shipping_address->state,
                    'country' => $payment->payer->payer_info->shipping_address->country_code,
                ]
            ];

            // Send email function here ...

            return redirect()
                    ->route('bookstore.shipping')
                    ->with('success', 'Transaction payment success!');
        }

        return redirect()
                ->route('bookstore.shipping')
                ->with('danger', 'Payment failed.');
    }

}
25 Jun
10 months ago

jonjie left a reply on Redirect Back To Website After Payment In Paypal

Hi @Yorki. Do you have another way to do this? Coz if I used this package, I'm gonna require a confidential infos. Thanks

jonjie left a reply on Redirect Back To Website After Payment In Paypal

Hi @Yorki . Thanks for your reply. Uhmm, I don't know how to use it. The documentation is very general. Do you have any specific tutorial for this? Thanks again.

jonjie started a new conversation Redirect Back To Website After Payment In Paypal

Hello. How can I redirect the user back to my website after the payment in paypal? so I can send an email and display a success message to the user. I'm using laravel v5.1 here. Thanks a lot.

20 Jun
10 months ago

jonjie left a reply on How To Determine A Framework?

@Nash I'm still confused with this.

jonjie started a new conversation How To Determine A Framework?

Hi guys. I've searched over the internet but I didn't get the right one. I just want to ask how can I determine if something (PHP or JS) is a framework or a library. I'm really confused. For example, jQuery, some say that this is a framework, and some are not. Also VueJS, I think it is a library, but in documentation, it says it is a framework. I'm really really confused. Thanks.

11 Jun
11 months ago

jonjie left a reply on Podcast Download

@Snapey Thanks for the link :)

jonjie left a reply on Podcast Download

@Resin I also know this trick, but is it okay to download it like that? I mean, is it legit? Thanks.

jonjie started a new conversation Podcast Download

I know I can download a video from the series. But, I also want to download podcasts so I can still listen to it even if I'm offline. Can I download a podcast? And since the list is not yet that super bulky, how can download it all at once? Thanks a lot.

29 May
11 months ago

jonjie started a new conversation Why Do We Need Other Package To Test?

Hi. I'm just thinking why do we really need to use other packages like PHPUnit to test our application? Why not just using the application on how users use it? Like for example if we have a registration functionality, why not just test it by just using the application itself? Sorry but I'm really confused about it. I also read this https://softwareengineering.stackexchange.com/questions/116076/why-use-phpunit-when-traditional-manual-testing-can-be-used, but still confusing.

28 May
11 months ago

jonjie left a reply on Cannot Modify Country In Paypal

Yeah, thank man, co'z I don't have a telephone to call them. I think that's the only way to contact them; they don't have a chat support, only contact numbers.

jonjie left a reply on Cannot Modify Country In Paypal

It didn't work with the <fieldname>. Other fields are working except the country.

jonjie started a new conversation Cannot Modify Country In Paypal

Hi. I'm implementing a paypal payment in my website but the country is not changing when I'm checking out. Please see my code below:

<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
    <input type="hidden" name="cmd" value="_s-xclick">

    <div class="form-group">
        <input type="hidden" name="address_override" value="1">
        <input type="hidden" name="address1" value="Shipping Address">
        <input type="hidden" name="address2" value="Building name and office number">


        <input type="hidden" name="city" value="Tokyo">
        <input type="hidden" name="zip" value="2024">
        <input type="hidden" name="country" value="JP">
    </div>
</form>