mirror of
https://git.meshkee.com/cssd/cssd-back.git
synced 2026-10-13 20:51:06 +03:30
fix media
This commit is contained in:
@@ -7,8 +7,9 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
|
|
||||||
class MediaHelper
|
class MediaHelper
|
||||||
{
|
{
|
||||||
public static function moveMediaTo($model) {
|
public static function moveMediaTo( $model )
|
||||||
|
{
|
||||||
|
try {
|
||||||
request()->validate( [
|
request()->validate( [
|
||||||
'file_batch_id' => 'nullable|string' ,
|
'file_batch_id' => 'nullable|string' ,
|
||||||
] );
|
] );
|
||||||
@@ -23,7 +24,9 @@ class MediaHelper
|
|||||||
}
|
}
|
||||||
$fakeModel->delete();
|
$fakeModel->delete();
|
||||||
}
|
}
|
||||||
|
} catch ( \Exception $exception ) {
|
||||||
|
dd( $exception );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function storeMediaFor( Model $model , string $batchId = null )
|
public static function storeMediaFor( Model $model , string $batchId = null )
|
||||||
@@ -51,7 +54,8 @@ class MediaHelper
|
|||||||
return $model->getMorphClass();
|
return $model->getMorphClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function moveTinyMCEMediaTo($model) {
|
public static function moveTinyMCEMediaTo( $model )
|
||||||
|
{
|
||||||
|
|
||||||
request()->validate( [
|
request()->validate( [
|
||||||
'tinymce_batch_id' => 'nullable|string' ,
|
'tinymce_batch_id' => 'nullable|string' ,
|
||||||
@@ -70,7 +74,8 @@ class MediaHelper
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function loadMedia($model, ...$collections) {
|
public static function loadMedia( $model , ...$collections )
|
||||||
|
{
|
||||||
$model->loadMissing( [ 'media' => function ( $query ) use ( $collections ) {
|
$model->loadMissing( [ 'media' => function ( $query ) use ( $collections ) {
|
||||||
$query->select( '*' );
|
$query->select( '*' );
|
||||||
if ( ! empty( $collections ) ) {
|
if ( ! empty( $collections ) ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user