Skip to content

Powers Steadfast Collective's Summit platform and other apps.

License

Notifications You must be signed in to change notification settings

steadfast-collective/laravel-summit

Repository files navigation

Summit

Total Downloads Latest Stable Version License

Introduction

This package powers Steadfast Collective's Summit platform and other apps. It provides a starting point for building video course applications.

Documentation

Installation

  1. Install via Composer
composer require steadfastcollective/laravel-summit
  1. Run the summit:install command to publish Summit's files:
php artisan summit:install

Migrations

During installation, you'll get the option to publish Summit's migrations. These migrations create a few tables (courses, course_blocks and videos). These tables are used for some of Summit's built-in models. Feel free to add any columns to these as you wish.

Extending Models

Summit provides a set of models for things like Courses, Course Blocks and Videos. By default, these models live inside the Summit package. However, there may be cases where you want to add fillable properties, attributes or simply just want to override something we've done. And that's perfectly okay!

The recommended approach to doing this would be to create your own model file, like app/Models/Course.php. Inside that, instead of extending the Model class provided by Eloquent, extend the built-in Summit model. There's a demo of this below:

<?php

namespace App\Models;

use SteadfastCollective\Summit\Models\Course as SummitCourse;

class Course extends SummitCourse
{
    protected $appends = [
        'hello_world',
    ];

    public function getHelloWorldAttribute()
    {
        return 'Hello World!';
    }
}

Depending on the model you're overriding, it may be necessary to tell Summit about your updated model. You can do this inside the configuration file published by Summit during install.

/*
|--------------------------------------------------------------------------
| Course Model
|--------------------------------------------------------------------------
|
| Which class should we reference as the course model? It's used
| to store and retrieve the courses.
|
*/

'course_model' => \SteadfastCollective\Summit\Models\Course::class,

/*
|--------------------------------------------------------------------------
| Course Block Model
|--------------------------------------------------------------------------
|
| Which class should we reference as the course block model? It's used
| to store and retrieve the course blocks.
|
*/

'course_block_model' => \SteadfastCollective\Summit\Models\CourseBlock::class,

/*
|--------------------------------------------------------------------------
| User Model
|--------------------------------------------------------------------------
|
| Which class should we reference as the user model? It'll be used when
| associating course blocks with users (for tracking their progress).
| If null, we'll fallback to the model used in your `auth.php` file.
|
*/

'user_model' => null,

Laravel Nova

If you're using Laravel Nova within your application, you can optionally publish our base Nova resources. They're included as part of the summit:install command. However, they will only be shown if we detect Nova is installed.

php artisan summit:install

The Nova Resources will be published into your app/Nova directory. Once published, you can customise them to your heart's content.

We're using Spatie's Eloquent Sortable package to handle ordering of course blocks when creating. To extend on this functionality with Laravel Nova, we suggest using the Nova Sortable package.

Video Storage

There's a couple of different places you can store your videos. Out of the box, we currently support uploading to Laravel's Filesystem and to api.video.

Laravel Filesystem

/*
|--------------------------------------------------------------------------
| Video Storage
|--------------------------------------------------------------------------
|
| Where should we retrieve and upload your videos? We have built-in
| support for Laravel's Filesystem and api.video
|
*/

'video_storage_driver' => \SteadfastCollective\Summit\VideoStorage\FilesystemDriver::class,

// Only required with the `FilesystemDriver`
'video_storage_disk' => env('FILESYSTEM_DRIVER', 'public'),

When you configure the filesystem driver, be sure to also configure a video_storage_disk. This will be the disk (from your config/filesystems.php) you wish to be use for storage.

When uploading video with the uploadVideo method, you may pass in either an UploadedFile (which is the output of $request->file('video')) or you can pass a string containing the path to the video (useful if you're using Laravel Vapor).

$courseBlock->uploadVideo($request->file('video'), 'course-videos');

api.video

/*
|--------------------------------------------------------------------------
| Video Storage
|--------------------------------------------------------------------------
|
| Where should we retrieve and upload your videos? We have built-in
| support for Laravel's Filesystem and api.video
|
*/

'video_storage_driver' => \SteadfastCollective\Summit\VideoStorage\ApiVideoDriver::class,

When using our built-in api.video integration, you'll need to pull in our steadfastcollective/laravel-api-video package. If you don't we'll just throw an exception to tell you off (just kidding, of course).

Unlike our Filesystem driver, you can only pass in a Video ID string to the uploadVideo method when using api.video. The Video ID should be returned once the video has been uploaded successfully client-side.

$courseBlock->uploadVideo($request->get('api_video_id'));

Contributing

Before contributing, please read the our contibutors guide.

Security

If you discover any security related issues, please email dev@steadfastcollective.com instead of using the issue tracker.

About

Powers Steadfast Collective's Summit platform and other apps.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages