?? ? ?? ?? ?? 1452
SQLSTATE [23000] : ??? ?? ?? ?? : 1452 ?? ?? ????? ???? ? ? ???? : ?? ? ?? ?? ??? ???? ?????? ??? ?? ?? ?????. ??????? ?? ? ??? ????? ???? ?? ??? (? : Subdisputor)?? ?? ? ?? (? : ID_DSO)? ?? ?? ??? (? : DSO)? ?? 1 ? ? ?? (ID_DSO)?? ??? ?? ? ??? ?? ?????.
??? ??, ?? ???? report_sales.subdiptributor ???? ?? ? ?? ??? ??? _id_dso_foreign? dso ???? id_dso ?? ???? ??? ????? ?? ??? ?? ??? ???? ????. ?? ??? (...) ? (subdist001, superindi, dso-aceh, ...)? ?? ??? ???? id_dso? ?? dso-aceh? ???? ????????. ?, ??????? dso ???? id_dso ??? dso-aceh ?? ?? ?????.
???? ??? ???
??? ?? ?? ?? ??? ????? ??? ?? ??? ?? ?????.
1. ?? ??? ???? ???????
??? ?? ???? ?????. ?? ??? ???? ????? ? ? ?? ? ???? ?? ? ?? ??? ???? ??? ???? ????.
?? ?? :
??? ?? ?? : ?? ?? ??? ?? ?? ?? ?? (? : Excel/CSV)?? ID_DSO ?? ?? ??????.
-
?? ??? ?? : ??????? ?? ??? DSO? ?? ???? ?? ?? ??? ?? ?? ID_DSO ??? ????? ??????.
-?? ???? 'dso-aceh'? ??? ?????? dso?? count (*)? ??????. id_dso = 'dso-aceh'; -?? ?? ???? ?? ?? ???? ???? ?? ?? ?? ???? ?? id_dso ?? ???? ?? ? ? ????. ??? ID_DSO ? ??? ( 'dso-aceh', 'dso-banda', 'dso-medan')?? ?????. ??? id_dso? ??????. -??? ?? ?? ???? ???? 'dso-aceh'? id_dso Union All? ??? ???? ????? ????? ?? ?? ? ? ??? ?????. 'DSO-Banda'? ID_DSO Union All? ?????? id_dso? 'dso-medan'? ?????? ) imported_dso? imported_dso.id_dso? ?? ? (dso?? id_dso? ??);
???:
- ?? ??? ?? ??? ??? : ?? ??? ???? ?? ?? ?? ??????? ?? ?? ? ?? ?? ??? ??? (? : DSO ???? ?? id_dso ?)? ?? ????? ??????.
- ??? ?? : ?? ????? ?? ??? ?? ??? ???? ?? ?, ?? ?? ???? ?? ???? ??????.
2. ??? ?? ?? ?? ???
?? ???? ?????, ??? ?? ?? ?? ?? ?? ?? ??? ?? ???? ?? ??? ??? ???? ??? ?? ? ?? ??? ?? ? ? ????. ?? ??, ?? ??? ID_DSO? int ????, Child Table ID_DSO? Varchar ?????.
?? ?? :
- ?????? ?? ?? : DSO ???? ?????? ??? ?? ??? ???? ???? ID_DSO ?? ??? ??? ???? ??????. ??? CreateSubdistributor ???????? :
$ table-> String ( 'id_dso'); // Subdisputior? id_dso $ table-> ?? ( 'id_dso')-> ?? ( 'id_dso')-> on ( 'dso');
ID_DSO ?? ??? ???? ????? DSO ???? ?????? ??? ?????? ??? ????? ?? ??? ???????. ?? ??, DSO ??? ??????? ??? ????.
schema :: create ( 'dso', function (blueprint $ table) { $ table-> String ( 'id_dso'); // ??? ??? ???????. // ... ?? ? $ table-> ?? ( 'id_dso'); });
- ?????? ?? ?? : DSO.id_dso ? subdistributor.id_dso? ??? ??, ??, ?? ?? ? ????? PhpmyAdmin, DBeaver, MySQL Workbench? ?? ?????? ?? ??? ?? ???? ??? ????? ??????.
???:
- ??? ?????? ?? : ???? ???? ?? ?????? ??? ?? ? ?? ?? ? ??????? ?? ??????. ?? : ?? ???? ???? ?? ???? ??????.
- ?????? ?? ?? : ??????? ?? ? ??? ?? ?????? ??? ??? ???? ???? ???? ??? ? ????.
3. ??? ?? ?? ?? ??? ??
??? ????? ???? ??? ?? ?? (? : ??, ?? ????) ?? ?????? ???? ???? ??????? ?? ???? ?? ??? ?? ? ? ????.
?? ?? :
- ??? ??? : ?? ?? ???? ??? ?? (trim ())? ?? ? ?? ?????.
- ??? ?? : ??????, ???, ? ? ?? ?? ?? ??? ?? ???? ???? ??? ?????? (UTF8MB4 ??).
???:
-
??? ??? : ?? ??? ????? ???? ?? ? ?? ?? ? ???? Trim () ??? ??????.
// row ()? ?? ?? ? (array $ row)? () subdistributorimport ???? ??? { // id_dso $ iddso = trim ($ row [ 'id_dso']); // ?? $ row [2] ??? ? ?? // DSO ???? $ iddso? ????? ??????. //? ?? ?? ??? ??? ????? ?? ??? ?? ? ???? :: ?? ( "dso id '{$ iddso}'subdisputor import? ?? ?? ? ????."); ? ??; //? ??? ?? ??} ?? ?? ???? ????? ([[[ // ... ?? ?? 'id_dso'=> $ iddso, // ... ]); }
?? ?? ? ?? ??
??? ??? ?? ?? ??, ?? ?? ??? ?? ?? ?????? ??? ?? ??? ??? ?? ????.
-
??? ?? : ??? ??????? ???? ?? ??? ? ??? ?? ???? ?????. ?? ? ??? ??, ??? ???? ?? ??? ??? ??????. Laravel Excel? Validation ?????? ???? ?? ?? ??? ?? ??? ?? ? ? ????.
// subDistributorImport.php maatwebsite \ excel \ concerns \ tomodel? ??????. maatwebsite \ excel \ ??? \ withheadingrow? ??????. maatwebsite \ excel \ ??? \ withvalidation? ??????. Illuminate \ Validation \ Rule? ??????. Class Subdistributorimport? Headingrow? ?? Tomodel? ????? { ?? ?? ?? (?? $ ?) { // ... ?? ?? ??} ?? ?? ?? () : ?? { ?? [ 'id_dso'=> [ '???', '?', // dso ??? ??? id_dso ?? id_dso? ??? ?????? :: ????? ( 'dso', 'id_dso'), ],, // ... ?? ??? ?? ?? ??]; } // customValidationMessages () ?? customValidationAttributes ()? ????? ??? ? ????. }
?? : Rule :: ENSIMS? ???? ?? ?? ???? ?? ?????? ??? ?????. ??? ??? ?? ??? ??? ? ? ????. ? ?? Cache All ID_DSO? ?? ????? ??? ?? ?? ??? ?? ? ? ????.
-
???? ?? : ?? ?? ?? ????? ?????? ?????? ?????. ?? ?? ???? ?? ???? ?? ?? ? ?? ??? ???? ?????? ??? ???? ???? ?? ?? ????? ?????.
// ????? public function import_excel (?? $ ??) { $ this-> Validate ($ request, [ 'file'=> '?? | Mimes : CSV, XLS, XLSX' ]); $ file = $ request-> file ( 'file'); $ nama_file = rand (). $ file-> getClientoriginalName (); $ file-> move ( 'file_subdistributor', $ nama_file); db :: begintransaction (); // ???? ?? ?? { Excel :: import (New SubdistributorImport, public_path ( '/file_subdistributor/'.$ nama_file)); DB :: Commit (); // ???? ?? ?? :: Flash ( 'sukses', '??? ?? ??? Berhasil Diimport!'); } catch (\ maatwebsite \ excel \ exclators \ validationException $ e) { db :: rollback (); // ?? ???? $ ?? = $ e-> ?? (); // ???? ?? ?? ?? (? : ??? $ errors)? ????? = []; foreach ($ ??? $ ??) { $ ?? [] = "?". $ failure-> row (). ":". ". Implode ( ",", $ failure-> errors ()); } ?? :: Flash ( 'gagal', '??? ?? ?? ?? :'. Implode ( ";", $ ??)); } catch (\ exception $ e) { db :: rollback (); // ?? ???? ?? :: Flash ( 'gagal', '??? ?? ???? ??? ??????.'. $ e-> getMessage ()); // ?? ?? ?? ?? ?? ?? :: error ( "Excel ?? ?? ?? :". $ e-> getMessage ()); } ???? ???? ( '/subdistributor'); }
?? ? ?? ?? : ?? ?? ?? ???? ?? ??? ? ??, ?? ?? ?? ? ??? ??? ???? ???? ?? ??? ?????. ?? ?? ?? ?? ?? ? ?? ??? ?? ????.
??
??? ?? ?? ??? ?????? ?? : 1452 ??? ??? ???? ???? ????. ?? ?, ?? ?? ?? ??? ??? ??? ??? ?? ? ?? ??? ????.
- ?? ??? ???? ?? ????? ??????.
- ??-?? ?? ? ??? ??? ??? ??? ??? ???? ??????.
- ?? ? ???? ????? ??? ? ??? ?? ??? ??????.
- ??? ??? ?????? ???? ????? ???? ?? ?? ????? ???? ??????.
??? ??? ?? ??? ??? ?? ?? ?? ??? ??? ???? ??????? ???? ????? ??, ?? ? ??? ? ????.
? ??? Laravel? ?? ? ?? ?? ?? ?? : ??? ??? ? ?? ?? ??? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

PHP ?? ??? ?? ???? ?? ? ????? ??? ?????. 1. ?? ??? ??? ??? ??? ? ? ??? ??? ??? ?? ?? ??? ???? ???????. 2. ?? ??? ???? ???? ? ?? ????? ?? ?? ?? ??? ?????. 3. $ _get ? $ _post? ?? Hyperglobal ??? ?? ???? ?? ??? ? ??? ??? ??????? ???????. 4. ?? ?? ?? ???? ?? ?? ?? ??? ?????? ?? ??? ??? ?? ??? ???????. ??? ??? ????? ??? ??? ?? ???? ????? ? ??? ? ? ????.

PHP ?? ???? ???? ????? ?? ? ??? ???? ?? ?? ? ??? ???? ?? ??? ?????? ??? ??? ? ? ???????. 1. ??? ?? CSRF? ???? ?? ??? ??? ???? ?????? ??? ???? FINFO_FILE? ?? ?? MIME ??? ?????. 2. ??? ??? ??? ???? ??? ?? ??? ?? ? WEB ????? ??? ???? ??????. 3. PHP ?? ??? ?? ? ?? ???? NGINX/APACHE? ??? ????? ?? ???? ?????. 4. GD ?????? ??? ? ?? ???? ??? ?? ??? ?? ????.

PHP ?? ???? ? ?? ???? ??? ????. 1. // ?? #? ???? ? ?? ??? ???? // ???? ?? ????. 2. ?? /.../ ?? ?? ?? ??? ????? ?? ? ?? ??? ?? ? ? ????. 3. ?? ?? ?? / if () {} /? ?? ?? ??? ????? ??? ?? ?? ?? ??? ???? ????? ???? ??? ?? ???? ???? ??? ? ??? ??????.

Ageneratorinphpisamemory- ???? Way-Erate-Overgedatasetsetsbaluesoneatimeatimeatimeatimallatonce.1.generatorsuseTheyieldKeywordTocroadtOpvaluesondemand, RetingMemoryUsage.2

PHP ??? ???? ??? ??? ??? ????? ????. ??? ????? ?? ???? ??? "?? ? ?"??? "?"? ???????. 1. ??? ? ??? ??? DocBlock (/*/)? ?? ?? ??? ???? ??? ? ?? ???? ??????. 2. JS ??? ???? ?? ???? ??? ?? ??? ??? ?????. 3. ??? ?? ?? ?? ??? ???? ????? ????? ???? ?? ????? ???? ? ??????. 4. Todo ? Fixme? ????? ???? ? ? ??? ??? ???? ?? ?? ? ??? ???????. ??? ???? ?? ??? ??? ?? ?? ?? ???? ???? ? ????.

PHP??? ???? ??? ?? ?? ????? ???? ??? ?? ??? ??? ?? ? ??? ??? ???? ?????. ???? 0?? ???? ?? ??? ???? ? ?? ???? ?? ?? ? ? ????. MB_SUBSTR? ?? ??? ??? ???????. ? : $ str = "hello"; echo $ str [0]; ?? H; ??? MB_SUBSTR ($ str, 1,1)? ?? ??? ??? ??? ??????. ?? ???????? ???? ??? ???? ?? ???? ?? ?? ???? ?????? ??? ????? ?? ??? ?? ??? ???? ???? ?? ????.

toinstallphpquickly, usexampponwindowsorhomebrewonmacos.1. ??, downloadandinstallxAmpp, selectComponents, startApache ? placefilesinhtdocs.2

tolearnpheffectical, startBysetTupaloCalserErverEnmentUsingToolslikexamppandacodeeditor -likevscode.1) installxamppforapache, mysql, andphp.2) useacodeeditorforsyntaxsupport.3)) 3) testimplephpfile.next, withpluclucincludechlucincluclucludechluclucled
