Compare commits
3 commits
main
...
feature/pr
Author | SHA1 | Date | |
---|---|---|---|
|
ab514bfcf5 | ||
|
a6f2a4fac7 | ||
|
900ffdb56f |
3 changed files with 42 additions and 66 deletions
66
README.md
66
README.md
|
@ -64,69 +64,3 @@ If you discover a security vulnerability within Laravel, please send an e-mail t
|
||||||
## License
|
## License
|
||||||
|
|
||||||
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
|
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
|
||||||
|
|
||||||
|
|
||||||
# Linux Install
|
|
||||||
|
|
||||||
## Debian 11
|
|
||||||
|
|
||||||
Install guide for debian 11
|
|
||||||
|
|
||||||
### Pre Reqs
|
|
||||||
|
|
||||||
#### Install Composer
|
|
||||||
* https://www.digitalocean.com/community/tutorials/how-to-install-composer-on-debian-11-quickstart (only do after install PHP 8.2 if that is not done see the commands in the install commands section)
|
|
||||||
|
|
||||||
### Install Commands
|
|
||||||
```
|
|
||||||
sudo apt update
|
|
||||||
apt-get install apache2 curl git unzip mariadb-server -y
|
|
||||||
sudo apt install lsb-release apt-transport-https ca-certificates software-properties-common -y
|
|
||||||
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
|
|
||||||
sudo sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install php8.2 -y
|
|
||||||
php -v
|
|
||||||
sudo apt install libapache2-mod-php8.2 php8.2-mbstring php8.2-curl php8.2-gd php8.2-intl php8.2-odbc php8.2-mysql php8.2-pdo-sqlite php8.2-xml
|
|
||||||
sudo systemctl restart apache2
|
|
||||||
cd /var/www/html/
|
|
||||||
git clone git@code.techinc.nl:techinc/printer-manager-admin.git
|
|
||||||
chown -R www-data:www-data printer-manager-admin/
|
|
||||||
printer-manager-admin
|
|
||||||
cd printer-manager-admin
|
|
||||||
composer install
|
|
||||||
sudo mysql_secure_installation
|
|
||||||
sudo mysql -u root -p
|
|
||||||
CREATE DATABASE printer_manager_admin;
|
|
||||||
CREATE USER 'printer-manager-admin'@'localhost' IDENTIFIED BY 'your_password';
|
|
||||||
GRANT ALL PRIVILEGES ON printer_manager_admin.* TO 'printer-manager-admin'@'localhost';
|
|
||||||
FLUSH PRIVILEGES;
|
|
||||||
exit;
|
|
||||||
cp .env.example .env
|
|
||||||
```
|
|
||||||
vim .env (edit the db config)
|
|
||||||
```
|
|
||||||
php artisan key:generate
|
|
||||||
php artisan migrate
|
|
||||||
php artisan make:filament-user
|
|
||||||
```
|
|
||||||
```
|
|
||||||
vim /etc/apache2/sites-enabled/000-default.conf (set DocumentRoot /var/www/html/printer-manager-admin/public)
|
|
||||||
vim /etc/apache2/apache2.conf
|
|
||||||
```
|
|
||||||
add the following:
|
|
||||||
```
|
|
||||||
<Directory /var/www/html/printer-manager-admin/public>
|
|
||||||
Options Indexes FollowSymLinks
|
|
||||||
AllowOverride All
|
|
||||||
Require all granted
|
|
||||||
</Directory>
|
|
||||||
```
|
|
||||||
Then Run:
|
|
||||||
```
|
|
||||||
a2en enable rewrite
|
|
||||||
systemctl restart apache2
|
|
||||||
```
|
|
||||||
You are good to go!
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Api\Printer;
|
||||||
|
|
||||||
|
use App\Http\Resources\Printer\ListPrinterResource;
|
||||||
|
use App\Models\Printer;
|
||||||
|
use App\Http\Responses\ApiResponse;
|
||||||
|
use Illuminate\Support\Facades\Http;
|
||||||
|
|
||||||
|
class ClearQueuePrinterController
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
public function __invoke(string $id)
|
||||||
|
{
|
||||||
|
//todo fetch printer from request instead of doing it on controller
|
||||||
|
$printer = Printer::find($id);
|
||||||
|
|
||||||
|
//todo validate from rquest class
|
||||||
|
$data = request()->input('params');
|
||||||
|
|
||||||
|
$baseUrl = 'http://' .$printer->config->networkFormat();
|
||||||
|
|
||||||
|
|
||||||
|
//todo create service class to send requests
|
||||||
|
$httpClient = Http::withHeaders([
|
||||||
|
// 'Accept-Language' => $integrationProfile->api_credentials['language'],
|
||||||
|
// 'Authorization' => $authToken,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$url = $baseUrl . '/server/job_queue/job';
|
||||||
|
|
||||||
|
$query = [];
|
||||||
|
$method = 'delete';
|
||||||
|
$response = $httpClient->{$method}($url, $method === 'get' ? $query : $data);
|
||||||
|
|
||||||
|
dd($response);
|
||||||
|
return ApiResponse::handle();
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use App\Http\Controllers\Api\Printer\ClearQueuePrinterController;
|
||||||
use App\Http\Controllers\Api\Printer\GetPrinterController;
|
use App\Http\Controllers\Api\Printer\GetPrinterController;
|
||||||
use App\Http\Controllers\Api\Printer\ListPrinterController;
|
use App\Http\Controllers\Api\Printer\ListPrinterController;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
@ -22,3 +23,4 @@ Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
|
||||||
|
|
||||||
Route::get('/printers', ListPrinterController::class);
|
Route::get('/printers', ListPrinterController::class);
|
||||||
Route::get('/printers/{id}', GetPrinterController::class);
|
Route::get('/printers/{id}', GetPrinterController::class);
|
||||||
|
Route::post('/printers/{id}/clear-queue', ClearQueuePrinterController::class);
|
||||||
|
|
Loading…
Reference in a new issue