add api display content
This commit is contained in:
@@ -0,0 +1,122 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Facades\Artisan;
|
||||||
|
use Illuminate\Support\Facades\File;
|
||||||
|
use Symfony\Component\Process;
|
||||||
|
use Symfony\Component\Process\Exception\ProcessFailedException;
|
||||||
|
|
||||||
|
class AdminSetup extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name and signature of the console command.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $signature = 'setup:first';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The console command description.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = 'This command for initialize dan .env';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the console command.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$envFile = base_path('.env');
|
||||||
|
$envExample = base_path('.env.example');
|
||||||
|
|
||||||
|
// Copy .env.example jika belum ada
|
||||||
|
if (! File::exists($envFile)) {
|
||||||
|
File::copy($envExample, $envFile);
|
||||||
|
$this->info('.env berhasil dibuat dari .env.example');
|
||||||
|
}
|
||||||
|
|
||||||
|
$dbConnection = $this->choice(
|
||||||
|
'Pilih database yang digunakan',
|
||||||
|
['mysql', 'pgsql', 'sqlite'],
|
||||||
|
1 // default pgsql
|
||||||
|
);
|
||||||
|
|
||||||
|
$dbHost = $this->ask('Masukkan IP Address / Host', '127.0.0.1');
|
||||||
|
$dbPort = $this->ask(
|
||||||
|
'Masukkan Port Database',
|
||||||
|
$dbConnection === 'mysql' ? '3306' : '5432'
|
||||||
|
);
|
||||||
|
$dbDatabase = $this->ask('Masukkan Nama Database', 'parkir');
|
||||||
|
$dbUsername = $this->ask('Masukkan Username Database', 'postgres');
|
||||||
|
$dbPassword = $this->secret('Masukkan Password Database');
|
||||||
|
|
||||||
|
$env = file_get_contents($envFile);
|
||||||
|
|
||||||
|
$replacements = [
|
||||||
|
'APP_DEBUG' => 'true',
|
||||||
|
'DB_CONNECTION' => $dbConnection,
|
||||||
|
'DB_HOST' => $dbHost,
|
||||||
|
'DB_PORT' => $dbPort,
|
||||||
|
'DB_DATABASE' => $dbDatabase,
|
||||||
|
'DB_USERNAME' => $dbUsername,
|
||||||
|
'DB_PASSWORD' => $dbPassword,
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($replacements as $key => $value) {
|
||||||
|
$env = preg_replace(
|
||||||
|
"/^{$key}=.*/m",
|
||||||
|
"{$key}={$value}",
|
||||||
|
$env
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
file_put_contents($envFile, $env);
|
||||||
|
|
||||||
|
$this->info('Konfigurasi .env berhasil diperbarui.');
|
||||||
|
|
||||||
|
$this->newLine();
|
||||||
|
|
||||||
|
$this->table(
|
||||||
|
['Key', 'Value'],
|
||||||
|
[
|
||||||
|
['DB_CONNECTION', $dbConnection],
|
||||||
|
['DB_HOST', $dbHost],
|
||||||
|
['DB_PORT', $dbPort],
|
||||||
|
['DB_DATABASE', $dbDatabase],
|
||||||
|
['DB_USERNAME', $dbUsername],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->newLine();
|
||||||
|
|
||||||
|
if ($this->confirm('Jalankan php artisan key:generate?', true)) {
|
||||||
|
Artisan::call('key:generate');
|
||||||
|
$this->line(Artisan::output());
|
||||||
|
}
|
||||||
|
|
||||||
|
// if ($this->confirm('Jalankan php artisan migrate?', false)) {
|
||||||
|
// Artisan::call('migrate', ['--force' => true]);
|
||||||
|
// $this->line(Artisan::output());
|
||||||
|
// }
|
||||||
|
|
||||||
|
if ($this->confirm('Jalankan php artisan config:clear?', true)) {
|
||||||
|
Artisan::call('config:clear');
|
||||||
|
$this->line(Artisan::output());
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->confirm('Jalankan php artisan cache:clear?', true)) {
|
||||||
|
Artisan::call('cache:clear');
|
||||||
|
$this->line(Artisan::output());
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->info('Setup selesai.');
|
||||||
|
|
||||||
|
return Command::SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Api\V1;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class DisplayContentController extends Controller
|
||||||
|
{
|
||||||
|
public function index() {
|
||||||
|
// $path = 'assets/content/display_content/image/';
|
||||||
|
|
||||||
|
// return response()->json([
|
||||||
|
// "id" => 1,
|
||||||
|
// "type" => 'image',
|
||||||
|
// 'content' => [
|
||||||
|
// url($path . '1.jpg'),
|
||||||
|
// url($path . '2.jpg'),
|
||||||
|
// url($path . '3.jpg'),
|
||||||
|
// url($path . '4.jpg'),
|
||||||
|
// url($path . '5.jpg'),
|
||||||
|
// ]
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
$path = 'assets/content/display_content/video/';
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
"id" => 1,
|
||||||
|
"type" => 'video',
|
||||||
|
'content' => [
|
||||||
|
// "display_1" => url($path . '1.mp4'),
|
||||||
|
// "display_2" => url($path . '2.mp4'),
|
||||||
|
// "display_3" => url($path . '3.mp4'),
|
||||||
|
// url($path . '1.mp4'),
|
||||||
|
url($path . 'video_2bak.mp4'),
|
||||||
|
url($path . 'video_3bak.mp4'),
|
||||||
|
// url($path . 'new_3.mp4'),
|
||||||
|
// url($path . 'new_4.mp4'),
|
||||||
|
// url($path . 'new_5.mp4'),
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('softseting_displaycontent', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->integer('screen_id');
|
||||||
|
$table->string('type');
|
||||||
|
$table->string('filename');
|
||||||
|
$table->integer('duration');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('softseting_displaycontent');
|
||||||
|
}
|
||||||
|
};
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 542 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 530 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.1 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 595 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 290 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -3,6 +3,7 @@
|
|||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
use App\Http\Controllers\Api\V1\ConfigParameter;
|
use App\Http\Controllers\Api\V1\ConfigParameter;
|
||||||
|
use App\Http\Controllers\Api\V1\DisplayContentController;
|
||||||
use App\Http\Controllers\Api\V1\LaporanController;
|
use App\Http\Controllers\Api\V1\LaporanController;
|
||||||
use App\Http\Controllers\Api\V1\MemberinController;
|
use App\Http\Controllers\Api\V1\MemberinController;
|
||||||
use App\Http\Controllers\Api\V1\TransaksiMember;
|
use App\Http\Controllers\Api\V1\TransaksiMember;
|
||||||
@@ -40,3 +41,7 @@
|
|||||||
Route::post('gate', [LaporanController::class, 'gate']);
|
Route::post('gate', [LaporanController::class, 'gate']);
|
||||||
Route::post('daily', [LaporanController::class, 'daily']);
|
Route::post('daily', [LaporanController::class, 'daily']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Route::prefix('display')->group(function () {
|
||||||
|
Route::get('content', [DisplayContentController::class, 'index']);
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user