Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
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.
We can then get our subscriptions.
Then at the beginning of the for each,
after setting the repo we're going to check our subscription.
We'll set subscribed equal to false.
And then we're going to loop through our subscriptions.
If our repo is equal to sub full name.
Then we'll set subscribed equal to true.
We can then add the subscription as part of the package array.
Subscribed Is equal to our variable subscribed.
If we want our alert to display,
then we're going to have to add those as an argument.
Finally, we can update project.html to include the subscription.html file.
Let's make a final review of our site.
Going to the project repos.
We can now watch our project repos as well.
You need to sign up for Treehouse in order to download course files.Sign up