Skip to content

Commit

Permalink
Merge pull request #47 from mostafaznv/dev
Browse files Browse the repository at this point in the history
bugfix
  • Loading branch information
mostafaznv authored May 5, 2023
2 parents 3b02bd4 + 4a2656b commit a8e2885
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 24 deletions.
44 changes: 24 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ CkEditor 5 for Laravel Nova.
Includes custom written plugins for media (video and image), snippet and publishable stubs for out-of-the-box usage.

----
I develop in a open-source journey 🚀, I wish I lived in an environment where financial situation was fine and I could only focus on the path, but as you may know, life isn't perfect. <br>So if you end up using my packages, please consider making a donation, any amount would go along way and is much appreciated. 🍺
I am on an open-source journey 🚀, and I wish I could solely focus on my development path without worrying about my financial situation. However, as life is not perfect, I have to consider other factors.

Therefore, if you decide to use my packages, please kindly consider making a donation. Any amount, no matter how small, goes a long way and is greatly appreciated. 🍺

[![Donate](https://mostafaznv.github.io/donate/donate.svg)](https://mostafaznv.github.io/donate)

Expand Down Expand Up @@ -73,28 +75,27 @@ You should create a disk in `config/filesystems.php`:
This package uses [nova-video](https://github.com/mostafaznv/nova-video) to handle videos, so you can choose between [larupload](https://github.com/mostafaznv/larupload) and laravel's built-in file-system to handle upload process.

1. Create a disk in `config/filesystems.php`:
```
'disks' => [
'video' => [
'driver' => 'local',
'root' => public_path('uploads/video'),
'url' => env('APP_URL') . 'uploads/video',
```
'disks' => [
'video' => [
'driver' => 'local',
'root' => public_path('uploads/video'),
'url' => env('APP_URL') . 'uploads/video',
]
]
]
```

> **Note**: If you want to change the disk name, you should rename it in these places: <br>
> **- With Larupload**: In `App\Models\Video` (disk function of `Attachment` class) <br>
> **- Without Larupload**: In `App\Nova\Resources\Model` (third argument of make function in `VideoUpload` field)

>**Note**: Larupload uses **FFMPEG** to generate cover from original video file, and it will try to find the FFMPEG binary path from your system's environment. but you can define it by yourself by publishing larupload config file. <br> `php artisan vendor:publish --provider="Mostafaznv\Larupload\LaruploadServiceProvider"`
```

> If you want to change the disk name, you should rename it in these places: <br>
**With Larupload**: In `App\Models\Video` (disk function of `Attachment` class) <br>
**Without Larupload**: In `App\Nova\Resources\Model` (third argument of make function in `VideoUpload` field)

> Larupload uses **FFMPEG** to generate cover from original video file, and it will try to find the FFMPEG binary path from your system's environment. but you can define it by yourself by publishing larupload config file. <br> `php artisan vendor:publish --provider="Mostafaznv\Larupload\LaruploadServiceProvider"`
2. Prepare migration and model:
1. In the case you chose larupload, there is nothing to do with migration and model. you can find more configuration options in [nova-video](https://github.com/mostafaznv/nova-video) and [larupload](https://github.com/mostafaznv/larupload) documentations.
2. But if you chose laravel's file-system, you must make some changes in migration and model. You should remove larupload **trait** and **attachments function** from model and use **string column** instead of **upload column** in migration file.
2. But if you chose Laravel's file-system, you must make some changes in migration and model. You should remove larupload **trait** and **attachments function** from model and use **string column** instead of **upload column** in migration file.

Migration
#### Migration
```
class CreateVideosTable extends Migration
{
Expand All @@ -108,7 +109,8 @@ class CreateVideosTable extends Migration
});
}
```
Model

#### Model
```
class Video extends Model
{
Expand Down Expand Up @@ -302,7 +304,9 @@ return [


------
I develop in a open-source journey 🚀, I wish I lived in an environment where financial situation was fine and I could only focus on the path, but as you may know, life isn't perfect. <br>So if you end up using my packages, please consider making a donation, any amount would go along way and is much appreciated. 🍺
I am on an open-source journey 🚀, and I wish I could solely focus on my development path without worrying about my financial situation. However, as life is not perfect, I have to consider other factors.

Therefore, if you decide to use my packages, please kindly consider making a donation. Any amount, no matter how small, goes a long way and is greatly appreciated. 🍺

[![Donate](https://mostafaznv.github.io/donate/donate.svg)](https://mostafaznv.github.io/donate)

Expand Down
2 changes: 1 addition & 1 deletion dist/css/field.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/js/field.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions dist/js/field.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */

/**
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
Expand Down
4 changes: 2 additions & 2 deletions stubs/models/Video.stub
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ class Video extends Model

protected $fillable = ['name', 'file', 'disk'];

protected static function boot()
protected static function booted(): void
{
parent::boot();
parent::booted();

self::saving(function($model) {
$hasLaruploadTrait = method_exists(self::class, 'bootLarupload');
Expand Down

0 comments on commit a8e2885

Please sign in to comment.