Skip to content

Commit a249add

Browse files
author
Martin Kluska
committed
fixed the schedule register usage
updated readme
1 parent ce68269 commit a249add

File tree

3 files changed

+40
-26
lines changed

3 files changed

+40
-26
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "pion/laravel-chunk-upload",
33
"description": "Service for chunked upload with several js providers",
44
"require": {
5-
"laravel/framework": "5.*"
5+
"laravel/framework": "5.1.* || 5.2.* || 5.3.*"
66
},
77
"require-dev": {
88
},

readme.md

+19-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,23 @@
11
# Laravel chunked upload
2+
Easy to use service for chunked upload with several js providers on top of Laravel's file upload.
3+
4+
[![Total Downloads](https://poser.pugx.org/pion/laravel-chunk-upload/downloads?format=flat)](https://packagist.org/packages/pion/laravel-chunk-upload)
5+
[![Latest Stable Version](https://poser.pugx.org/pion/laravel-chunk-upload/v/stable?format=flat)](https://packagist.org/packages/pion/laravel-chunk-upload)
6+
[![Latest Unstable Version](https://poser.pugx.org/pion/laravel-chunk-upload/v/unstable?format=flat)](https://packagist.org/packages/pion/laravel-chunk-upload)
7+
8+
* [Installation](#installation)
9+
* [Usage](#usage)
10+
* [Supports](#supports)
11+
* [Features](#features)
12+
* [Basic documentation](#basic-documentation)
13+
* [Example](#example)
14+
* [Javascript](#javascript)
15+
* [Laravel controller](#laravel.controller)
16+
* [Controller](#controller)
17+
* [Route](#route)
18+
* [Providers/Handlers](#providers-handlers)
19+
* [Changelog](#changelog)
20+
* [Contribution](#contribution)
221

322
## Instalation
423

@@ -24,12 +43,6 @@ Run the publish command to copy the translations (Laravel 5.2 and above)
2443
php artisan vendor:publish --provider="Pion\Laravel\ChunkUpload\Providers\ChunkUploadServiceProvider"
2544
```
2645

27-
Run the publish command to copy the translations (Laravel 5.1)
28-
29-
```
30-
php artisan publish --provider="Pion\Laravel\ChunkUpload\Providers\ChunkUploadServiceProvider"
31-
```
32-
3346
## Usage
3447

3548
In your own controller create the `FileReceiver`, more in example.

src/Providers/ChunkUploadServiceProvider.php

+20-19
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,21 @@ class ChunkUploadServiceProvider extends ServiceProvider
1818
*/
1919
public function boot()
2020
{
21-
// get the schedule config
22-
$schedule = AbstractConfig::config()->scheduleConfig();
21+
// Get the schedule config
22+
$scheduleConfig = AbstractConfig::config()->scheduleConfig();
2323

24-
// run only if schedule is enabled
25-
if (Arr::get($schedule, "enabled", false) === true) {
24+
// Run only if schedule is enabled
25+
if (Arr::get($scheduleConfig, "enabled", false) === true) {
2626

27-
// wait until the app is fully booted
28-
$this->app->booted(function () use ($schedule) {
29-
// get the sheduler
27+
// Wait until the app is fully booted
28+
$this->app->booted(function () use ($scheduleConfig) {
29+
30+
// Get the scheduler instance
3031
/** @var Schedule $schedule */
3132
$schedule = $this->app->make(Schedule::class);
3233

33-
// register the clear chunks with custom schedule
34-
$schedule->command('uploads:clear')->cron(Arr::get($schedule, "cron", "* * * * *"));
34+
// Register the clear chunks with custom schedule
35+
$schedule->command('uploads:clear')->cron(Arr::get($scheduleConfig, "cron", "* * * * *"));
3536
});
3637
}
3738
}
@@ -43,26 +44,26 @@ public function boot()
4344
* @see ChunkUploadServiceProvider::registerConfig()
4445
*/
4546
public function register()
46-
{
47-
// register the commands
47+
{
48+
// Register the commands
4849
$this->commands([
4950
ClearChunksCommand::class
5051
]);
5152

52-
// register the config
53+
// Register the config
5354
$this->registerConfig();
5455

55-
// register the config via abstract instance
56+
// Register the config via abstract instance
5657
$this->app->singleton(AbstractConfig::class, function () {
5758
return new FileConfig();
5859
});
5960

60-
// register the config via abstract instance
61+
// Register the config via abstract instance
6162
$this->app->singleton(ChunkStorage::class, function (Application $app) {
6263
/** @var AbstractConfig $config */
6364
$config = $app->make(AbstractConfig::class);
64-
65-
// build the chunk storage
65+
66+
// Build the chunk storage
6667
return new ChunkStorage(\Storage::disk($config->chunksDiskName()), $config);
6768
});
6869
}
@@ -76,17 +77,17 @@ public function register()
7677
*/
7778
protected function registerConfig()
7879
{
79-
// config options
80+
// Config options
8081
$configIndex = FileConfig::FILE_NAME;
8182
$configFileName = FileConfig::FILE_NAME.".php";
8283
$configPath = __DIR__.'/../../config/'.$configFileName;
8384

84-
// publish the config
85+
// Publish the config
8586
$this->publishes([
8687
$configPath => config_path($configFileName),
8788
]);
8889

89-
// merge the default config to prevent any crash or unfiled configs
90+
// Merge the default config to prevent any crash or unfilled configs
9091
$this->mergeConfigFrom(
9192
$configPath, $configIndex
9293
);

0 commit comments

Comments
 (0)