- restriksi untuk print dihilangkan - stempel pada ttd ditambahkann - isi surat disesuaikan - ukuran kertas disesuaikan - data siswa baru ditambahkan
58 lines
1.3 KiB
PHP
58 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use Illuminate\Console\Command;
|
|
use App\Imports\HasilBelajarsImport;
|
|
use App\Imports\K13HasilBelajarsImport;
|
|
use Maatwebsite\Excel\Facades\Excel;
|
|
|
|
class ImportExcel extends Command
|
|
{
|
|
/**
|
|
* The name and signature of the console command.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $signature = 'ba:import-excel {filename} {--k|kurikulum=}';
|
|
|
|
/**
|
|
* The console command description.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $description = 'Import excel file to table';
|
|
|
|
/**
|
|
* Create a new command instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
|
|
/**
|
|
* Execute the console command.
|
|
*
|
|
* @return mixed
|
|
*/
|
|
public function handle()
|
|
{
|
|
try {
|
|
if ($this->option('kurikulum')) {
|
|
if ($this->option('kurikulum') == 'k13')
|
|
Excel::import(new K13HasilBelajarsImport, $this->argument('filename'));
|
|
else
|
|
throw new Exception('Kurikulum tidak ditemukan.');
|
|
}
|
|
else {
|
|
Excel::import(new HasilBelajarsImport, $this->argument('filename'));
|
|
}
|
|
} catch (\Exception $e) {
|
|
echo $e->getMessage();
|
|
}
|
|
}
|
|
}
|