mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
copied modules, resources, and updated route files
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Classes\Modules\Announcements\DataTransferObjects;
|
||||
|
||||
use App\Classes\General\Interfaces\DataTransferObject;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class AnnouncementObject implements DataTransferObject
|
||||
{
|
||||
@@ -53,18 +54,20 @@ class AnnouncementObject implements DataTransferObject
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @return Carbon
|
||||
*/
|
||||
public function getStartingOn(): string
|
||||
public function getStartingOn(): Carbon
|
||||
{
|
||||
return $this->starting_on;
|
||||
// return $this->starting_on;
|
||||
return Carbon::parse($this->starting_on);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @return Carbon
|
||||
*/
|
||||
public function getEndingOn(): string
|
||||
public function getEndingOn(): Carbon
|
||||
{
|
||||
return $this->ending_on;
|
||||
// return $this->ending_on;
|
||||
return Carbon::parse($this->ending_on);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class AnnouncementResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'title' => $this->title,
|
||||
'description' => $this->description,
|
||||
'segments' => $this->segments,
|
||||
'starting_on' => Carbon::parse($this->starting_on)->format('Y-m-d'),
|
||||
'ending_on' => Carbon::parse($this->ending_on)->format('Y-m-d'),
|
||||
'created_at' => Carbon::parse($this->created_at)->format('d-m-Y'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,9 @@ Route::group(['prefix' => 'announcement', 'as' => 'announcement.', 'namespace' =
|
||||
Route::put('/update/{id}', 'UpdateAnnouncementController@update')->name('update');
|
||||
Route::delete('/delete/{id}', 'DeleteAnnouncementController@delete')->name('delete');
|
||||
|
||||
Route::group(['prefix' => '{id}/segment', 'as' => 'segment.'], function () {
|
||||
Route::group(['prefix' => '/{id}/segment', 'as' => 'segment.'], function () {
|
||||
Route::post('/assign', 'AssignAnnouncementToSegmentController@assign')->name('assign');
|
||||
Route::delete('/detach/{segment_id}', 'RemoveSegmentFromAnnouncementController@detach')->name('detach');
|
||||
});
|
||||
|
||||
});
|
||||
@@ -56,4 +56,6 @@ Route::group(['middleware' => 'api', 'prefix' => 'v1', 'as' => 'api.'], function
|
||||
Route::get('/report/service', 'Reports\MonthlyReportController@serviceReport')->name('report.service');
|
||||
|
||||
});
|
||||
|
||||
require __DIR__ . '/announcement.php';
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user