Switching PLD Endpoints, Operation Summary.
This commit is contained in:
parent
80c7cb68ba
commit
ba6ed3c747
@ -3,19 +3,42 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests\UploadInfoSectorialRequest;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Traits\ApiResponse;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class InfoSectorialController extends Controller
|
||||
{
|
||||
use ApiResponse;
|
||||
|
||||
public function updateFile(UploadInfoSectorialRequest $uploadInfoSectorialRequest)
|
||||
{
|
||||
$data = $uploadInfoSectorialRequest->all();
|
||||
|
||||
dd($uploadInfoSectorialRequest->validated());
|
||||
if (!$uploadInfoSectorialRequest->hasFile('reportfile')) {
|
||||
return $this->errorResponse( false, '', 500);
|
||||
}
|
||||
|
||||
$file = $uploadInfoSectorialRequest->file('reportfile');
|
||||
|
||||
$data['name'] = Str::of($file->getClientOriginalName())->explode('.')->offsetGet(0);
|
||||
$extension = $file->getClientOriginalExtension();
|
||||
|
||||
$data['reportfile'] = $file->storeAs('file', $data['name'].".{$extension}");
|
||||
|
||||
dd($data);
|
||||
|
||||
}
|
||||
|
||||
public function download(){
|
||||
public function download()
|
||||
{
|
||||
$file = public_path("/file/Clockify_Time_Report_Detailed_01_05_2022-31_05_2022.pdf");
|
||||
|
||||
return response()->download();
|
||||
$path = storage_path("public/file/Clockify_Time_Report_Detailed_01_05_2022-31_05_2022.pdf");
|
||||
|
||||
|
||||
$headers = ['Content-Type: application/pdf'];
|
||||
$newName = 'itsolutionstuff-pdf-file-'.time().'.pdf';
|
||||
|
||||
return response()->download($path, $newName, $headers);
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,7 +12,6 @@ use Illuminate\Http\Response;
|
||||
|
||||
class PldController extends Controller
|
||||
{
|
||||
|
||||
use ApiResponse;
|
||||
|
||||
public function __construct(
|
||||
@ -23,6 +22,9 @@ class PldController extends Controller
|
||||
{
|
||||
try {
|
||||
$response = $this->pldContract->search($request->all());
|
||||
|
||||
dd($response);
|
||||
|
||||
return (new PldResource($response))
|
||||
->response()
|
||||
->setStatusCode(Response::HTTP_OK);
|
||||
|
||||
@ -13,7 +13,7 @@ class UploadInfoSectorialRequest extends FormRequest
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -15,7 +15,8 @@ return new class extends Migration
|
||||
{
|
||||
Schema::create('info_sectorial', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('file_url');
|
||||
$table->string('title');
|
||||
$table->string('path');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
|
||||
@ -25,6 +25,10 @@ Route::middleware(['auth:sanctum', 'verified'])->group(function () {
|
||||
|
||||
Route::get('faq', [\App\Http\Controllers\FaqController::class, 'index']);
|
||||
Route::get('faq/{faq}', [\App\Http\Controllers\FaqController::class, 'show']);
|
||||
|
||||
Route::post('operation', [\App\Http\Controllers\OperationSummaryController::class, 'index']);
|
||||
|
||||
Route::post('pld', [\App\Http\Controllers\PldController::class, 'index']);
|
||||
});
|
||||
|
||||
Route::middleware(['auth:sanctum', 'ability:Admin'])->group(function () {
|
||||
@ -42,7 +46,6 @@ Route::middleware(['auth:sanctum', 'ability:Admin'])->group(function () {
|
||||
});
|
||||
|
||||
Route::middleware(['auth:sanctum', 'ability:Client'])->group(function () {
|
||||
Route::post('pld', [\App\Http\Controllers\PldController::class, 'index']);
|
||||
Route::post('pld/overview', [\App\Http\Controllers\PldController::class, 'overviewByRegion']);
|
||||
Route::post('pld/list', [\App\Http\Controllers\PldController::class, 'listConsumption']);
|
||||
Route::post('pld/daily', [\App\Http\Controllers\PldController::class, 'consumptionByDaily']);
|
||||
@ -55,7 +58,6 @@ Route::middleware(['auth:sanctum', 'ability:Client'])->group(function () {
|
||||
Route::post('economy/MWh', [\App\Http\Controllers\EconomyController::class, 'costMWhEconomy']);
|
||||
|
||||
Route::post('operation/summary', [\App\Http\Controllers\OperationSummaryController::class, 'operationSummary']);
|
||||
Route::post('operation', [\App\Http\Controllers\OperationSummaryController::class, 'index']);
|
||||
|
||||
Route::post('download', [\App\Http\Controllers\InfoSectorialController::class, 'download']);
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user