<?php

use App\Imports\ImportDapodikGuru;
use App\Imports\ImportDapodikSiswa;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use Maatwebsite\Excel\Facades\Excel;

Route::post('/cobaimport/dataguru', function(Request $request){
    try{
        Excel::import(new ImportDapodikGuru, $request->file('file'));
        return response()->json(['message' => 'Success']);
    }catch(\Exception $e){
        return response()->json(['error' => 'Failed to create model: ' . $e->getMessage()], 500);
    }
}); 

Route::post('/cobaimport/datasiswa', function(Request $request){
    try{
        Excel::import(new ImportDapodikSiswa, $request->file('file'));
        return response()->json(['message' => 'Success']);
    }catch(\Exception $e){
        return response()->json(['error' => 'Failed to create model: ' . $e->getMessage()], 500);
    }
}); 