Added mpdf temp storage code
This commit is contained in:
@@ -57,7 +57,7 @@ class PalletController extends Controller
|
|||||||
'margin_right' => 0,
|
'margin_right' => 0,
|
||||||
'margin_top' => 0,
|
'margin_top' => 0,
|
||||||
'margin_bottom' => 0,
|
'margin_bottom' => 0,
|
||||||
//'tempDir' => '/var/www/storage/mpdf-tmp',
|
'tempDir' => '/var/www/storage/mpdf-tmp',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$mpdf->WriteHTML($html);
|
$mpdf->WriteHTML($html);
|
||||||
|
|||||||
115
app/Http/Controllers/UserController.php
Normal file
115
app/Http/Controllers/UserController.php
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\User;
|
||||||
|
use Hash;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class UserController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the specified resource.
|
||||||
|
*/
|
||||||
|
//show(string $id)
|
||||||
|
public function get_testing_data(Request $request)
|
||||||
|
{
|
||||||
|
$expectedUser = env('API_AUTH_USER');
|
||||||
|
$expectedPw = env('API_AUTH_PW');
|
||||||
|
$header_auth = $request->header('Authorization');
|
||||||
|
$header_user = $request->header('User-Name');
|
||||||
|
$header_pass = $request->header('User-Pass');
|
||||||
|
$expectedToken = $expectedUser . ':' . $expectedPw;
|
||||||
|
|
||||||
|
if ("Bearer " . $expectedToken !== $header_auth)
|
||||||
|
{
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'ERROR',
|
||||||
|
'status_description' => 'Invalid authorization token!'
|
||||||
|
], 403);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$header_user)
|
||||||
|
{
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'ERROR',
|
||||||
|
'status_description' => 'Invalid user name found!'
|
||||||
|
], 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
$existUser = User::where('name', $header_user)->first();
|
||||||
|
|
||||||
|
if (!$existUser)
|
||||||
|
{
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'ERROR',
|
||||||
|
'status_description' => 'Unknown user name found!'
|
||||||
|
], 400);
|
||||||
|
}
|
||||||
|
// if ($header_user !== $existUser->name)
|
||||||
|
// {
|
||||||
|
// return response()->json([
|
||||||
|
// 'status_code' => 'ERROR',
|
||||||
|
// 'status_description' => 'Unknown user name found'
|
||||||
|
// ], 400);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Retrieve the user by email
|
||||||
|
//$user = User::where('email', $email)->first();
|
||||||
|
if (Hash::check($header_pass, $existUser->password)) {
|
||||||
|
return response()->json([
|
||||||
|
'roles' => $existUser->roles()->pluck('name')->toArray()
|
||||||
|
], 200);
|
||||||
|
} else {
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'ERROR',
|
||||||
|
'status_description' => 'Password does not match!'
|
||||||
|
], 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
// $machines = User::with('plant')->with('line')->orderBy('plant_id')->get();
|
||||||
|
// $machinesData = $machines->map(function($machine) {
|
||||||
|
// return [
|
||||||
|
// 'plant_code' => $machine->plant ? (String)$machine->plant->code : "",
|
||||||
|
// 'group_work_center' => $machine->line->group_work_center ?? "",
|
||||||
|
// 'work_center' => $machine->work_center ?? "",
|
||||||
|
// ];
|
||||||
|
// });
|
||||||
|
|
||||||
|
// return response()->json([
|
||||||
|
// 'machines' => $machinesData
|
||||||
|
// ]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*/
|
||||||
|
public function update(Request $request, string $id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*/
|
||||||
|
public function destroy(string $id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user