VideoJS Events and AJAX Requests

Let’s review a full of example of how you might submit an AJAX request to your server, once a video has concluded. Perhaps you allow your users to mark videos as "completed" (just like you can here at Laracasts). Let’s see how to do that. First, in this lesson, we’ll prepare the Laravel backend code and then use some fairly basic JavaScript and jQuery to submit the AJAX request. In the next video, we’ll switch to using npm and Vue.

View the source for this lesson on GitHub.
Source: Laracasts

phpBB 3.1.9 is out

phpBB 3.1.9 is now available, please be sure to backup your forum before staring in the update process .

we are happy to help you in updating your forum safely, please reply to this email if you are interested in our paid sevices.

Easily Test Email with MailThief

Laravel Mailthief

MailThief is a new package by Tighten Co. that provides a fake mailer for your Laravel application. This makes it easy to test email without actually sending any.

To better explain how this package works take a look at the following example from the project.

First, pretend you have a registration route that sends the user a welcome email:

Route::post('register', function () {
    // <snip> Validation, create account, etc. </snip>

    Mail::send('emails.welcome', [], function ($m) {
        $email = request('email');
        $m->to($email),
        $m->subject('Welcome to my app!');
        $m->from('noreply@example.com');
        $m->bcc('notifications@example.com');
    });

    // <snip> Return response </snip>
});

Typically testing this would be pretty difficult, but with MailThief it’s simple:

use MailThiefFacadesMailThief;

class RegistrationTest extends TestCase
{
    public function test_new_users_are_sent_a_welcome_email()
    {
        // Block and intercept outgoing mail, important!
        MailThief::hijack();

        $this->post('register', [
            'name' => 'John Doe',
            'email' => 'john@example.com',
            'password' => 'secret',
        ]);

        // Check that an email was sent to this email address
        $this->assertTrue(MailThief::hasMessageFor('john@example.com'));

        // BCC addresses are included too
        $this->assertTrue(MailThief::hasMessageFor('notifications@example.com'));

        // Make sure the email has the correct subject
        $this->assertEquals('Welcome to my app!', MailThief::lastMessage()->subject);

        // Make sure the email was sent from the correct address
        // (`from` can be a list, so we return it as a collection)
        $this->assertEquals('noreply@example.com', MailThief::lastMessage()->from->first());
    }
}

You can grab the package from Github and if you’d like to learn more about the thought process behind building MailThief check out this post and video by Adam Wathan.

Source: Laravel News

Laravel Analytics v2

laravel analytics

Freek Van der Herten and Spatie.be recently released a new version of their popular Google Analytics package.

Since the first release of this package Google has changed the preferred way of authenticating for API usage and this new version accounts for that as well as cleaned up a lot of the code and made it only available for PHP 7.0+

The Google authentication is a pain and the readme does a great job of showing you the exact steps to take. Following along I was able to complete the setup without pulling out all my hair.

After the authentication is set working with the package is really nice. As an example, I wanted to see if I could generate a list of trending pages here on Laravel News for the past month. Here is all I needed to do:

$analytics->fetchMostVisitedPages(
    Period::create(Carbon::now()->subMonth(), Carbon::now())
);

That returns a Laravel Collection with a “url” and “pageViews” attribute:

Collection {#364 ▼
  #items: array:20 [▼
    0 => array:2 [▼
      "url" => "/"
      "pageViews" => 126600
    ]
    1 => array:2 [▼
      "url" => "/2016/06/look-whats-coming-laravel-5-3/"
      "pageViews" => 126599
    ]
    2 => array:2 [▼
      "url" => "/2016/06/laravel-and-elasticsearch/"
      "pageViews" => 126598
    ]

Of course, it includes other useful methods for the most common stats you will need:

  • fetchVisitorsAndPageViews()
  • fetchTopReferrers()
  • fetchTopBrowsers()
  • performQuery() – Advanced option to perform any query you need.

If you are needing to integrate with Google Analytics check out this package. Even you are not the market for analytics but still need to use Google API bookmark it as a guide for setting up API accounts.

Source: Laravel News

Video Event Handling 101

Next up, we’ll review how to respond to any number of video-specific events. Maybe you want to write to local storage every five seconds to record the user’s progress in the video. Or maybe you want to submit an AJAX request to your server each time a video is finished. It’s all a piece of cake!
Source: Laracasts

Laravel 5.3 will be released at Laracon US

Laravel 5.3

It was announced today that Laravel 5.3 will be officially released at this years Laracon US conference.

This means it’ll be out either July 28th or the 29th. Based on the current schedule, listed on the Laracon website, it’s looking like Taylor is currently only scheduled to talk on July 28th at 5:15 PM local Louisville time. So I’m putting my money on that being the day and time.

For more on 5.3 here is a post outlining some of the big new features. Laracon is already sold out and it’s going to be a great event.

Source: Laravel News

Set Up a Staging Server

In this episode, from scratch, we’ll learn how to setup a staging server in Laravel Forge, push to it, and then update our DNS, accordingly. It’s all a cinch!
Source: Laracasts

CloudFlare Down In Europe

CloudFlare

This morning CloudFlare has been having issues in Europe and many popular websites and services are down in that region. The Laravel site and services are using CloudFlare and you may notice an outage if you are in that area.

If you need to access to the Laravel documentation you can find the original markdown files in the Github repo.

It should be back up soon but this is always a good fallback.

Source: Laravel News

1 2 3 4