updated api Cartoons
This commit is contained in:
parent
8870aa93f6
commit
ed1f5f5846
|
|
@ -43,19 +43,46 @@ class CartoonsController extends Controller
|
||||||
return $this->helpers->apiArrayResponseBuilder(200, 'success', $filteredData);
|
return $this->helpers->apiArrayResponseBuilder(200, 'success', $filteredData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
public function show($id){
|
|
||||||
|
|
||||||
$data = $this->Cartoons::find($id);
|
$data = $this->Cartoons::find($id);
|
||||||
|
$baseUrl = url('/storage/app/media');
|
||||||
|
|
||||||
if (!is_null($data)){
|
if (!is_null($data)) {
|
||||||
return $this->helpers->apiArrayResponseBuilder(200, 'success', [$data]);
|
$dataArray = $data->toArray();
|
||||||
|
|
||||||
|
// Update the image URLs
|
||||||
|
$dataArray['list_image'] = $baseUrl . $dataArray['list_image'];
|
||||||
|
$dataArray['banner_image'] = $baseUrl . $dataArray['banner_image'];
|
||||||
|
$dataArray['logo'] = $baseUrl . $dataArray['logo'];
|
||||||
|
$dataArray['main_characters_image'] = $baseUrl . $dataArray['main_characters_image'];
|
||||||
|
$dataArray['shots_image'] = $baseUrl . $dataArray['shots_image'];
|
||||||
|
$dataArray['posters_image'] = $baseUrl . $dataArray['posters_image'];
|
||||||
|
|
||||||
|
if (!is_null($dataArray['list_characters'])) {
|
||||||
|
foreach ($dataArray['list_characters'] as &$character) {
|
||||||
|
foreach ($character['character_images'] as &$character_image) {
|
||||||
|
$character_image['image'] = $baseUrl . $character_image['image'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_null($dataArray['list_shots'])) {
|
||||||
|
foreach ($dataArray['list_shots'] as &$shot) {
|
||||||
|
$shot['shot_image'] = $baseUrl . $shot['shot_image'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_null($dataArray['list_posters'])) {
|
||||||
|
foreach ($dataArray['list_posters'] as &$poster) {
|
||||||
|
$poster['image'] = $baseUrl . $poster['image'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->helpers->apiArrayResponseBuilder(200, 'success', [$dataArray]);
|
||||||
} else {
|
} else {
|
||||||
return $this->helpers->apiArrayResponseBuilder(404, 'error', [$data]);
|
return $this->helpers->apiArrayResponseBuilder(404, 'error', null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store(Request $request){
|
public function store(Request $request){
|
||||||
|
|
|
||||||
|
|
@ -27,5 +27,9 @@ class Cartoons extends Model
|
||||||
'list_posters' => 'array'
|
'list_posters' => 'array'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public $attachOne = [
|
||||||
|
'trailer' => 'System\Models\File'
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -76,14 +76,23 @@ fields:
|
||||||
type: repeater
|
type: repeater
|
||||||
form:
|
form:
|
||||||
fields:
|
fields:
|
||||||
characters_image:
|
character_images:
|
||||||
label: 'Characters image'
|
label: 'Character images'
|
||||||
mode: image
|
prompt: 'Add new item'
|
||||||
thumbOptions:
|
maxItems: '3'
|
||||||
mode: crop
|
displayMode: accordion
|
||||||
extension: auto
|
|
||||||
span: auto
|
span: auto
|
||||||
type: mediafinder
|
type: repeater
|
||||||
|
form:
|
||||||
|
fields:
|
||||||
|
image:
|
||||||
|
label: Image
|
||||||
|
mode: image
|
||||||
|
thumbOptions:
|
||||||
|
mode: crop
|
||||||
|
extension: auto
|
||||||
|
span: auto
|
||||||
|
type: mediafinder
|
||||||
character_header:
|
character_header:
|
||||||
label: 'Character header'
|
label: 'Character header'
|
||||||
span: auto
|
span: auto
|
||||||
|
|
@ -136,6 +145,7 @@ fields:
|
||||||
list_posters:
|
list_posters:
|
||||||
label: 'List posters'
|
label: 'List posters'
|
||||||
prompt: 'Add new item'
|
prompt: 'Add new item'
|
||||||
|
maxItems: '3'
|
||||||
displayMode: accordion
|
displayMode: accordion
|
||||||
span: full
|
span: full
|
||||||
type: repeater
|
type: repeater
|
||||||
|
|
@ -143,7 +153,7 @@ fields:
|
||||||
fields:
|
fields:
|
||||||
image:
|
image:
|
||||||
label: poster_image
|
label: poster_image
|
||||||
mode: file
|
mode: image
|
||||||
thumbOptions:
|
thumbOptions:
|
||||||
mode: crop
|
mode: crop
|
||||||
extension: auto
|
extension: auto
|
||||||
|
|
@ -157,3 +167,12 @@ fields:
|
||||||
span: auto
|
span: auto
|
||||||
default: horizontal
|
default: horizontal
|
||||||
type: balloon-selector
|
type: balloon-selector
|
||||||
|
trailer:
|
||||||
|
label: Trailer
|
||||||
|
mode: file
|
||||||
|
useCaption: true
|
||||||
|
thumbOptions:
|
||||||
|
mode: crop
|
||||||
|
extension: auto
|
||||||
|
span: auto
|
||||||
|
type: fileupload
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ navigation:
|
||||||
url: tps/tps/partnerscontroller
|
url: tps/tps/partnerscontroller
|
||||||
icon: icon-bank
|
icon: icon-bank
|
||||||
side-menu-item5:
|
side-menu-item5:
|
||||||
label: Cartoons
|
label: 'Main Projects'
|
||||||
url: tps/tps/cartoonscontroller
|
url: tps/tps/cartoonscontroller
|
||||||
icon: icon-image
|
icon: icon-image
|
||||||
side-menu-item6:
|
side-menu-item6:
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?php namespace Tps\Tps\Updates;
|
||||||
|
|
||||||
|
use Schema;
|
||||||
|
use October\Rain\Database\Updates\Migration;
|
||||||
|
|
||||||
|
class BuilderTableUpdateTpsTpsCartoons3 extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('tps_tps_cartoons', function($table)
|
||||||
|
{
|
||||||
|
$table->string('trailer')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('tps_tps_cartoons', function($table)
|
||||||
|
{
|
||||||
|
$table->dropColumn('trailer');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -45,3 +45,6 @@ v1.0.15:
|
||||||
v1.0.16:
|
v1.0.16:
|
||||||
- 'Updated table tps_tps_cartoons'
|
- 'Updated table tps_tps_cartoons'
|
||||||
- builder_table_update_tps_tps_cartoons_2.php
|
- builder_table_update_tps_tps_cartoons_2.php
|
||||||
|
v1.0.17:
|
||||||
|
- 'Updated table tps_tps_cartoons'
|
||||||
|
- builder_table_update_tps_tps_cartoons_3.php
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue