Sharing Functionality in the Application2:39 with Alena Holligan
Now that we have the ability to watch and un-watch repositories, let's add that functionality to the Project Repos as well.
Open project.php, and we're going to require two files. 0:00 Inc/authenticate. 0:11 And inc/watch. 0:18 We can then get our subscriptions. 0:21 Then at the beginning of the for each, 0:43 after setting the repo we're going to check our subscription. 0:45 We'll set subscribed equal to false. 0:50 And then we're going to loop through our subscriptions. 0:56 If our repo is equal to sub full name. 1:07 Then we'll set subscribed equal to true. 1:25 We can then add the subscription as part of the package array. 1:31 Subscribed Is equal to our variable subscribed. 1:40 If we want our alert to display, 1:50 then we're going to have to add those as an argument. 1:52 Finally, we can update project.html to include the subscription.html file. 2:04 Let's make a final review of our site. 2:24 Going to the project repos. 2:29 We can now watch our project repos as well. 2:34
You need to sign up for Treehouse in order to download course files.Sign up