Laravel NFL Fantasy Football
Create new Laravel Web App composer require laravel/laravel
Install Laravel Auth php artisan make:auth
Remove the user table migration from database/migrations
run composer require 3brettb/fantasynfl
Change App\User class to extend FantasyNFL\Fantasy\Models\User
run php artisan vendor:publish
run php artisan migrate
Add an authenticated()
method to LoginController
/**
* Perform Fantasy NFL Login actions
*
* @param Request $request
* @param $user
*/
public function authenticated(Request $request, $user)
{
FantasyNFL::login($user);
}
Get Team Roster
FantasyNFL::roster($team_id);
Get League
FantasyNFL::find($league_id);
Get League Activity
$league->activity()
Get Entities involved with Activity
$activity->involved[0]->get()
Get Link <a> tag
associated with activity
$activity->links[0]->a_tag();
Get League Divisions
$league->divisions()
// -- or --
$league->division($division_id)
Get Division Teams
$division->teams()
Get Week
$league->week() // to get current week
$league->week($week_number) // to get specific week of current season
$league->week($week_number, $year) // returns week of the given season and number
Get Season
$league->season() // to get current season
$league->season($year) // to get specific season by year