add model,controller,migration,api

This commit is contained in:
Nazri Hamzah
2018-04-27 18:03:16 +08:00
parent 7b4e76b39e
commit 805d357048
43 changed files with 3254 additions and 167 deletions
+1
View File
@@ -20,6 +20,7 @@
<excludeFolder url="file://$MODULE_DIR$/vendor/jakub-onderka/php-console-highlighter" />
<excludeFolder url="file://$MODULE_DIR$/vendor/laravel/framework" />
<excludeFolder url="file://$MODULE_DIR$/vendor/laravel/tinker" />
<excludeFolder url="file://$MODULE_DIR$/vendor/laravelcollective/html" />
<excludeFolder url="file://$MODULE_DIR$/vendor/league/flysystem" />
<excludeFolder url="file://$MODULE_DIR$/vendor/mockery/mockery" />
<excludeFolder url="file://$MODULE_DIR$/vendor/monolog/monolog" />
Generated
+1
View File
@@ -73,6 +73,7 @@
<path value="$PROJECT_DIR$/vendor/monolog/monolog" />
<path value="$PROJECT_DIR$/vendor/psy/psysh" />
<path value="$PROJECT_DIR$/vendor/dragonmantank/cron-expression" />
<path value="$PROJECT_DIR$/vendor/laravelcollective/html" />
</include_path>
</component>
<component name="PhpProjectSharedConfiguration" php_language_level="7.1" />
+245 -130
View File
@@ -2,7 +2,27 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="6484ab30-2bf9-4d04-9c77-c2a07f14d069" name="Default" comment="">
<change beforePath="$PROJECT_DIR$/app/Providers/AppServiceProvider.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Providers/AppServiceProvider.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/exchange.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/exchange.iml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/php.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/php.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Exceptions/Handler.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Exceptions/Handler.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Rate.php" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/app/SettingCIEFBeneficiary.php" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/app/SettingSupplier.php" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/app/TimeLimit.php" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/composer.json" beforeDir="false" afterPath="$PROJECT_DIR$/composer.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/composer.lock" beforeDir="false" afterPath="$PROJECT_DIR$/composer.lock" afterDir="false" />
<change beforePath="$PROJECT_DIR$/config/app.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/app.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/database/migrations/2018_04_23_030854_create_rates_table.php" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/database/migrations/2018_04_23_032746_create_setting_suppliers_table.php" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/database/migrations/2018_04_23_033128_create_time_limits_table.php" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/database/migrations/2018_04_23_033425_create_setting_c_i_e_f_beneficiaries_table.php" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/routes/api.php" beforeDir="false" afterPath="$PROJECT_DIR$/routes/api.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/vendor/composer/autoload_classmap.php" beforeDir="false" afterPath="$PROJECT_DIR$/vendor/composer/autoload_classmap.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/vendor/composer/autoload_files.php" beforeDir="false" afterPath="$PROJECT_DIR$/vendor/composer/autoload_files.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/vendor/composer/autoload_psr4.php" beforeDir="false" afterPath="$PROJECT_DIR$/vendor/composer/autoload_psr4.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/vendor/composer/autoload_static.php" beforeDir="false" afterPath="$PROJECT_DIR$/vendor/composer/autoload_static.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/vendor/composer/installed.json" beforeDir="false" afterPath="$PROJECT_DIR$/vendor/composer/installed.json" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
@@ -15,32 +35,14 @@
<pharConfigPath>$PROJECT_DIR$/composer.json</pharConfigPath>
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="api.php" pinned="false" current-in-tab="false">
<leaf>
<file leaf-file-name="api.php" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/routes/api.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="414">
<caret line="18" selection-start-line="18" selection-end-line="18" />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="2018_04_23_033128_create_time_limits_table.php" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/database/migrations/2018_04_23_033128_create_time_limits_table.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="389">
<caret line="20" column="11" selection-start-line="20" selection-start-column="11" selection-end-line="20" selection-end-column="11" />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="AppServiceProvider.php" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/app/Providers/AppServiceProvider.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="667">
<caret line="29" lean-forward="true" selection-start-line="29" selection-end-line="29" />
<state relative-caret-position="273">
<caret line="25" column="30" selection-start-line="25" selection-start-column="12" selection-end-line="25" selection-end-column="30" />
<folding>
<element signature="e#33#72#0#PHP" expanded="true" />
<element signature="e#7#35#0#PHP" expanded="true" />
</folding>
</state>
</provider>
@@ -68,8 +70,26 @@
<option value="$PROJECT_DIR$/database/migrations/2018_04_23_032746_create_setting_suppliers_table.php" />
<option value="$PROJECT_DIR$/database/migrations/2018_04_23_033128_create_time_limits_table.php" />
<option value="$PROJECT_DIR$/database/migrations/2018_04_23_033425_create_setting_c_i_e_f_beneficiaries_table.php" />
<option value="$PROJECT_DIR$/routes/api.php" />
<option value="$PROJECT_DIR$/app/Providers/AppServiceProvider.php" />
<option value="$PROJECT_DIR$/config/app.php" />
<option value="$PROJECT_DIR$/resources/views/SettingSupplier/master.blade.php" />
<option value="$PROJECT_DIR$/resources/views/SettingSupplier/index.blade.php" />
<option value="$PROJECT_DIR$/app/Http/Controllers/SupplierSettingController.php" />
<option value="$PROJECT_DIR$/routes/web.php" />
<option value="$PROJECT_DIR$/database/migrations/2018_04_25_085705_create_rates_table.php" />
<option value="$PROJECT_DIR$/database/migrations/2018_04_25_090031_create_setting_suppliers_table.php" />
<option value="$PROJECT_DIR$/database/migrations/2018_04_25_090015_create_setting_credits_table.php" />
<option value="$PROJECT_DIR$/database/migrations/2018_04_25_090057_create_setting_beneficiaries_table.php" />
<option value="$PROJECT_DIR$/app/Rate.php" />
<option value="$PROJECT_DIR$/app/SettingBeneficiary.php" />
<option value="$PROJECT_DIR$/app/SettingCredit.php" />
<option value="$PROJECT_DIR$/app/SettingSupplier.php" />
<option value="$PROJECT_DIR$/routes/api.php" />
<option value="$PROJECT_DIR$/app/Http/Controllers/RateController.php" />
<option value="$PROJECT_DIR$/app/Http/Controllers/SettingBeneficiaryController.php" />
<option value="$PROJECT_DIR$/app/Http/Controllers/SettingCreditController.php" />
<option value="$PROJECT_DIR$/app/Http/Controllers/SettingSupplierController.php" />
<option value="$PROJECT_DIR$/app/Exceptions/Handler.php" />
</list>
</option>
</component>
@@ -158,15 +178,18 @@
<path value="$PROJECT_DIR$/vendor/monolog/monolog" />
<path value="$PROJECT_DIR$/vendor/psy/psysh" />
<path value="$PROJECT_DIR$/vendor/dragonmantank/cron-expression" />
<path value="$PROJECT_DIR$/vendor/laravelcollective/html" />
</include_path>
</component>
<component name="ProjectFrameBounds" extendedState="6">
<option name="x" value="806" />
<option name="y" value="158" />
<option name="width" value="1400" />
<option name="height" value="991" />
<option name="x" value="960" />
<option name="y" value="27" />
<option name="width" value="960" />
<option name="height" value="982" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="true">
<ConfirmationsSetting value="2" id="Add" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectView">
<navigator proportions="" version="1">
<foldersAlwaysOnTop value="true" />
@@ -176,35 +199,47 @@
<subPane>
<expand>
<path>
<item name="exchange" type="b2602c69:ProjectViewProjectNode" />
<item name="exchange" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="exchange 26.4" type="b2602c69:ProjectViewProjectNode" />
<item name="exchange 26.4" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="exchange" type="b2602c69:ProjectViewProjectNode" />
<item name="exchange" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="app" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="exchange 26.4" type="b2602c69:ProjectViewProjectNode" />
<item name="exchange 26.4" type="462c0819:PsiDirectoryNode" />
<item name="app" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="exchange" type="b2602c69:ProjectViewProjectNode" />
<item name="exchange" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="app" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="Providers" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="exchange 26.4" type="b2602c69:ProjectViewProjectNode" />
<item name="exchange 26.4" type="462c0819:PsiDirectoryNode" />
<item name="app" type="462c0819:PsiDirectoryNode" />
<item name="Http" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="exchange" type="b2602c69:ProjectViewProjectNode" />
<item name="exchange" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="database" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="exchange 26.4" type="b2602c69:ProjectViewProjectNode" />
<item name="exchange 26.4" type="462c0819:PsiDirectoryNode" />
<item name="app" type="462c0819:PsiDirectoryNode" />
<item name="Http" type="462c0819:PsiDirectoryNode" />
<item name="Controllers" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="exchange" type="b2602c69:ProjectViewProjectNode" />
<item name="exchange" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="database" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="migrations" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="exchange 26.4" type="b2602c69:ProjectViewProjectNode" />
<item name="exchange 26.4" type="462c0819:PsiDirectoryNode" />
<item name="database" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="exchange" type="b2602c69:ProjectViewProjectNode" />
<item name="exchange" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="routes" type="2a2b976b:PhpTreeStructureProvider$1" />
<item name="exchange 26.4" type="b2602c69:ProjectViewProjectNode" />
<item name="exchange 26.4" type="462c0819:PsiDirectoryNode" />
<item name="database" type="462c0819:PsiDirectoryNode" />
<item name="migrations" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="exchange 26.4" type="b2602c69:ProjectViewProjectNode" />
<item name="exchange 26.4" type="462c0819:PsiDirectoryNode" />
<item name="resources" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="exchange 26.4" type="b2602c69:ProjectViewProjectNode" />
<item name="exchange 26.4" type="462c0819:PsiDirectoryNode" />
<item name="routes" type="462c0819:PsiDirectoryNode" />
</path>
</expand>
<select />
@@ -245,47 +280,38 @@
<workItem from="1524427689138" duration="1242000" />
<workItem from="1524450424581" duration="5633000" />
<workItem from="1524457074965" duration="944000" />
<workItem from="1524623539555" duration="7966000" />
<workItem from="1524646446736" duration="1292000" />
<workItem from="1524704967991" duration="40000" />
<workItem from="1524795454164" duration="13463000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="7826000" />
<option name="totallyTimeSpent" value="32575000" />
</component>
<component name="ToolWindowManager">
<frame x="-1" y="-8" width="1922" height="1018" extended-state="6" />
<editor active="true" />
<frame x="0" y="-5" width="1920" height="1014" extended-state="6" />
<layout>
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.14375" />
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.14683816" />
<window_info anchor="bottom" id="TODO" order="6" />
<window_info anchor="bottom" id="Docker" order="7" show_stripe_button="false" />
<window_info anchor="bottom" id="Event Log" order="7" side_tool="true" />
<window_info anchor="right" id="Database" order="3" />
<window_info anchor="bottom" id="Database Changes" order="7" show_stripe_button="false" />
<window_info anchor="bottom" id="Version Control" order="7" />
<window_info anchor="bottom" id="Run" order="2" />
<window_info anchor="bottom" id="Version Control" order="7" weight="0.3288835" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info anchor="bottom" id="Terminal" order="7" />
<window_info id="Favorites" order="2" side_tool="true" />
<window_info active="true" anchor="bottom" id="Terminal" order="7" visible="true" weight="0.2453271" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
<window_info id="Favorites" order="2" side_tool="true" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
<window_info anchor="bottom" id="Docker" order="7" show_stripe_button="false" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.14375" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
<window_info anchor="bottom" id="TODO" order="6" />
<window_info anchor="bottom" id="Version Control" order="7" />
<window_info anchor="bottom" id="Run" order="2" />
<window_info anchor="bottom" id="Database Changes" order="7" show_stripe_button="false" />
<window_info anchor="right" id="Database" order="3" />
<window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Event Log" order="7" side_tool="true" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
<window_info anchor="bottom" id="Find" order="1" weight="0.32930845" />
<window_info anchor="bottom" id="Terminal" order="7" />
<window_info id="Favorites" order="2" side_tool="true" />
</layout>
</component>
<component name="TypeScriptGeneratedFilesManager">
@@ -295,6 +321,29 @@
<option name="myLimit" value="2678400000" />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/app/Http/Controllers/SupplierSettingController.php" />
<entry file="file://$PROJECT_DIR$/app/SettingSupplier.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="210">
<caret line="10" selection-start-line="10" selection-end-line="10" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/routes/web.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="441">
<caret line="30" lean-forward="true" selection-start-line="30" selection-end-line="30" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/routes/api.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="360">
<caret line="18" selection-start-line="18" selection-end-line="18" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/database/migrations/2018_04_23_030854_create_rates_table.php" />
<entry file="file://$PROJECT_DIR$/routes/api.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="437">
@@ -302,13 +351,7 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/database/migrations/2018_04_23_033128_create_time_limits_table.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="414">
<caret line="20" column="11" lean-forward="true" selection-start-line="20" selection-start-column="11" selection-end-line="20" selection-end-column="11" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/database/migrations/2018_04_23_033128_create_time_limits_table.php" />
<entry file="file://$PROJECT_DIR$/routes/api.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="342">
@@ -330,27 +373,9 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/database/migrations/2018_04_23_030854_create_rates_table.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="252">
<caret line="16" column="32" lean-forward="true" selection-start-line="16" selection-start-column="32" selection-end-line="16" selection-end-column="32" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/database/migrations/2018_04_23_032746_create_setting_suppliers_table.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="360">
<caret line="22" column="33" lean-forward="true" selection-start-line="22" selection-start-column="33" selection-end-line="22" selection-end-column="33" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/database/migrations/2018_04_23_033425_create_setting_c_i_e_f_beneficiaries_table.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="108">
<caret line="8" column="7" selection-start-line="8" selection-start-column="7" selection-end-line="8" selection-end-column="7" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/database/migrations/2018_04_23_030854_create_rates_table.php" />
<entry file="file://$PROJECT_DIR$/database/migrations/2018_04_23_032746_create_setting_suppliers_table.php" />
<entry file="file://$PROJECT_DIR$/database/migrations/2018_04_23_033425_create_setting_c_i_e_f_beneficiaries_table.php" />
<entry file="file://$PROJECT_DIR$/bootstrap/cache/services.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-522">
@@ -372,13 +397,7 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/database/migrations/2018_04_23_033128_create_time_limits_table.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="389">
<caret line="20" column="11" selection-start-line="20" selection-start-column="11" selection-end-line="20" selection-end-column="11" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/database/migrations/2018_04_23_033128_create_time_limits_table.php" />
<entry file="file://$PROJECT_DIR$/routes/api.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="342">
@@ -393,6 +412,70 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/bootstrap/cache/services.php" />
<entry file="file://$PROJECT_DIR$/app/Providers/AppServiceProvider.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="368">
<caret line="16" column="41" lean-forward="true" selection-start-line="16" selection-start-column="7" selection-end-line="16" selection-end-column="41" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/config/app.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="213">
<caret line="193" column="19" lean-forward="true" selection-start-line="193" selection-start-column="19" selection-end-line="193" selection-end-column="19" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/resources/views/SettingSupplier/master.blade.php" />
<entry file="file://$PROJECT_DIR$/resources/views/SettingSupplier/index.blade.php" />
<entry file="file://$PROJECT_DIR$/app/Http/Controllers/SupplierSettingController.php" />
<entry file="file://$PROJECT_DIR$/database/migrations/2018_04_23_030854_create_rates_table.php" />
<entry file="file://$PROJECT_DIR$/database/migrations/2018_04_23_032746_create_setting_suppliers_table.php" />
<entry file="file://$PROJECT_DIR$/database/migrations/2018_04_23_033128_create_time_limits_table.php" />
<entry file="file://$PROJECT_DIR$/database/migrations/2018_04_23_033425_create_setting_c_i_e_f_beneficiaries_table.php" />
<entry file="file://$PROJECT_DIR$/database/migrations/2018_04_25_090057_create_setting_beneficiaries_table.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="441">
<caret line="23" column="39" selection-start-line="23" selection-start-column="28" selection-end-line="23" selection-end-column="39" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/SettingCredit.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="168">
<caret line="8" column="64" selection-start-line="8" selection-start-column="64" selection-end-line="8" selection-end-column="64" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/SettingBeneficiary.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="168">
<caret line="8" column="108" selection-start-line="8" selection-start-column="4" selection-end-line="8" selection-end-column="108" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/SettingSupplier.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="210">
<caret line="10" lean-forward="true" selection-start-line="10" selection-end-line="10" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/database/migrations/2018_04_25_090031_create_setting_suppliers_table.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="399">
<caret line="21" column="34" selection-start-line="21" selection-start-column="28" selection-end-line="21" selection-end-column="34" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/database/migrations/2018_04_25_090015_create_setting_credits_table.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="336">
<caret line="18" column="45" selection-start-line="18" selection-start-column="29" selection-end-line="18" selection-end-column="45" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/.env">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="216">
@@ -400,48 +483,80 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/database/migrations/2018_04_23_030854_create_rates_table.php">
<entry file="file://$PROJECT_DIR$/app/Http/Controllers/SettingBeneficiaryController.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="252">
<caret line="16" column="32" lean-forward="true" selection-start-line="16" selection-start-column="32" selection-end-line="16" selection-end-column="32" />
<state relative-caret-position="737">
<caret line="39" column="1" lean-forward="true" selection-start-line="39" selection-start-column="1" selection-end-line="39" selection-end-column="1" />
<folding>
<element signature="e#40#67#0#PHP" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/database/migrations/2018_04_23_032746_create_setting_suppliers_table.php">
<entry file="file://$PROJECT_DIR$/app/Http/Controllers/SettingCreditController.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="360">
<caret line="22" column="33" lean-forward="true" selection-start-line="22" selection-start-column="33" selection-end-line="22" selection-end-column="33" />
<state relative-caret-position="548">
<caret line="33" column="49" lean-forward="true" selection-start-line="33" selection-start-column="49" selection-end-line="33" selection-end-column="49" />
<folding>
<element signature="e#40#62#0#PHP" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/database/migrations/2018_04_23_033425_create_setting_c_i_e_f_beneficiaries_table.php">
<entry file="file://$PROJECT_DIR$/app/Http/Controllers/SettingSupplierController.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="108">
<caret line="8" column="7" selection-start-line="8" selection-start-column="7" selection-end-line="8" selection-end-column="7" />
<state relative-caret-position="674">
<caret line="39" column="1" lean-forward="true" selection-start-line="39" selection-start-column="1" selection-end-line="39" selection-end-column="1" />
<folding>
<element signature="e#40#64#0#PHP" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/Exceptions/Handler.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="674">
<caret line="61" lean-forward="true" selection-start-line="61" selection-end-line="61" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/Rate.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="168">
<caret line="8" column="88" lean-forward="true" selection-start-line="8" selection-start-column="4" selection-end-line="8" selection-end-column="88" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/routes/web.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="147">
<caret line="16" selection-start-line="16" selection-end-line="16" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/database/migrations/2018_04_25_085705_create_rates_table.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="420">
<caret line="22" column="33" selection-start-line="22" selection-start-column="28" selection-end-line="22" selection-end-column="33" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/Http/Controllers/RateController.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="693">
<caret line="33" column="37" selection-start-line="33" selection-start-column="37" selection-end-line="33" selection-end-column="37" />
<folding>
<element signature="e#40#53#0#PHP" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/bootstrap/cache/services.php" />
<entry file="file://$PROJECT_DIR$/routes/api.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="414">
<caret line="18" selection-start-line="18" selection-end-line="18" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/database/migrations/2018_04_23_033128_create_time_limits_table.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="389">
<caret line="20" column="11" selection-start-line="20" selection-start-column="11" selection-end-line="20" selection-end-column="11" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/Providers/AppServiceProvider.php">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="667">
<caret line="29" lean-forward="true" selection-start-line="29" selection-end-line="29" />
<state relative-caret-position="273">
<caret line="25" column="30" selection-start-line="25" selection-start-column="12" selection-end-line="25" selection-end-column="30" />
<folding>
<element signature="e#33#72#0#PHP" expanded="true" />
<element signature="e#7#35#0#PHP" expanded="true" />
</folding>
</state>
</provider>
+8
View File
@@ -48,6 +48,14 @@ class Handler extends ExceptionHandler
*/
public function render($request, Exception $exception)
{
// This will replace our 404 response with
// a JSON response.
if ($exception instanceof ModelNotFoundException) {
return response()->json([
'error' => 'Resource not found'
], 404);
}
return parent::render($request, $exception);
}
}
+40
View File
@@ -0,0 +1,40 @@
<?php
namespace App\Http\Controllers;
use App\Rate;
use Illuminate\Http\Request;
class RateController extends Controller
{
public function index()
{
return Rate::all();
}
public function show(Rate $rate)
{
return $rate;
}
public function store(Request $request)
{
$rate = Rate::create($request->all());
return response()->json($rate, 201);
}
public function update(Request $request, Rate $rate)
{
$rate->update($request->all());
return response()->json($rate, 200);
}
public function delete(Rate $rate)
{
$rate->delete();
return response()->json(null, 204);
}
}
@@ -0,0 +1,40 @@
<?php
namespace App\Http\Controllers;
use App\SettingBeneficiary;
use Illuminate\Http\Request;
class SettingBeneficiaryController extends Controller
{
public function index()
{
return SettingBeneficiary::all();
}
public function show(SettingBeneficiary $beneficiary)
{
return $beneficiary;
}
public function store(Request $request)
{
$beneficiary = SettingBeneficiary::create($request->all());
return response()->json($beneficiary, 201);
}
public function update(Request $request, SettingBeneficiary $beneficiary)
{
$beneficiary->update($request->all());
return response()->json($beneficiary, 200);
}
public function delete(SettingBeneficiary $beneficiary)
{
$beneficiary->delete();
return response()->json(null, 204);
}
}
@@ -0,0 +1,40 @@
<?php
namespace App\Http\Controllers;
use App\SettingCredit;
use Illuminate\Http\Request;
class SettingCreditController extends Controller
{
public function index()
{
return SettingCredit::all();
}
public function show(SettingCredit $credit)
{
return $credit;
}
public function store(Request $request)
{
$credit = SettingCredit::create($request->all());
return response()->json($credit, 201);
}
public function update(Request $request, SettingCredit $credit)
{
$credit->update($request->all());
return response()->json($credit, 200);
}
public function delete(SettingCredit $credit)
{
$credit->delete();
return response()->json(null, 204);
}
}
@@ -0,0 +1,40 @@
<?php
namespace App\Http\Controllers;
use App\SettingSupplier;
use Illuminate\Http\Request;
class SettingSupplierController extends Controller
{
public function index()
{
return SettingSupplier::all();
}
public function show(SettingSupplier $supplier)
{
return $supplier;
}
public function store(Request $request)
{
$supplier = SettingSupplier::create($request->all());
return response()->json($supplier, 201);
}
public function update(Request $request, SettingSupplier $supplier)
{
$supplier->update($request->all());
return response()->json($supplier, 200);
}
public function delete(SettingSupplier $supplier)
{
$supplier->delete();
return response()->json(null, 204);
}
}
+1 -1
View File
@@ -6,5 +6,5 @@ use Illuminate\Database\Eloquent\Model;
class Rate extends Model
{
//
protected $fillable = ['x1_cash','x1_cheque','x1_ba','x2_cash','x2_cheque','x2_ba'];
}
+10
View File
@@ -0,0 +1,10 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class SettingBeneficiary extends Model
{
protected $fillable = ['company_name','bank_name','acc_no','bank_address','swift','cnap','bank_branch'];
}
-10
View File
@@ -1,10 +0,0 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class SettingCIEFBeneficiary extends Model
{
//
}
+10
View File
@@ -0,0 +1,10 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class SettingCredit extends Model
{
protected $fillable = ['rmb_credit_limit','usd_credit_limit'];
}
+1 -1
View File
@@ -6,5 +6,5 @@ use Illuminate\Database\Eloquent\Model;
class SettingSupplier extends Model
{
//
protected $fillable = ['company_name','gst_no','supplier_reg_no','bank_name','acc_no'];
}
-10
View File
@@ -1,10 +0,0 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class TimeLimit extends Model
{
//
}
+2 -1
View File
@@ -8,7 +8,8 @@
"php": "^7.1.3",
"fideloper/proxy": "^4.0",
"laravel/framework": "5.6.*",
"laravel/tinker": "^1.0"
"laravel/tinker": "^1.0",
"laravelcollective/html": "^5.6"
},
"require-dev": {
"filp/whoops": "^2.0",
Generated
+70 -2
View File
@@ -1,10 +1,10 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "d5bca48e56bbf3a25645858fcab9c285",
"content-hash": "379c5d3bbc3711c52e5d98b9762b2a79",
"packages": [
{
"name": "dnoegel/php-xdg-base-dir",
@@ -655,6 +655,74 @@
],
"time": "2018-03-06T17:34:36+00:00"
},
{
"name": "laravelcollective/html",
"version": "v5.6.6",
"source": {
"type": "git",
"url": "https://github.com/LaravelCollective/html.git",
"reference": "b3a10245c791a211e5f8ec37117f4549cd22aabe"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/LaravelCollective/html/zipball/b3a10245c791a211e5f8ec37117f4549cd22aabe",
"reference": "b3a10245c791a211e5f8ec37117f4549cd22aabe",
"shasum": ""
},
"require": {
"illuminate/http": "5.6.*",
"illuminate/routing": "5.6.*",
"illuminate/session": "5.6.*",
"illuminate/support": "5.6.*",
"illuminate/view": "5.6.*",
"php": ">=7.1.3"
},
"require-dev": {
"illuminate/database": "5.6.*",
"mockery/mockery": "~1.0",
"phpunit/phpunit": "~5.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.6-dev"
},
"laravel": {
"providers": [
"Collective\\Html\\HtmlServiceProvider"
],
"aliases": {
"Form": "Collective\\Html\\FormFacade",
"Html": "Collective\\Html\\HtmlFacade"
}
}
},
"autoload": {
"psr-4": {
"Collective\\Html\\": "src/"
},
"files": [
"src/helpers.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Taylor Otwell",
"email": "taylorotwell@gmail.com"
},
{
"name": "Adam Engebretson",
"email": "adam@laravelcollective.com"
}
],
"description": "HTML and Form Builders for the Laravel Framework",
"homepage": "https://laravelcollective.com",
"time": "2018-04-09T14:09:32+00:00"
},
{
"name": "league/flysystem",
"version": "1.0.44",
+2 -1
View File
@@ -146,6 +146,7 @@ return [
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
Collective\Html\HtmlServiceProvider::class,
/*
* Package Service Providers...
@@ -208,7 +209,7 @@ return [
'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
'Html' => Collective\Html\HtmlFacade::class,
],
];
+9
View File
@@ -0,0 +1,9 @@
<?php
use Faker\Generator as Faker;
$factory->define(App\Rate::class, function (Faker $faker) {
return [
//
];
});
@@ -0,0 +1,9 @@
<?php
use Faker\Generator as Faker;
$factory->define(App\SettingBeneficiary::class, function (Faker $faker) {
return [
//
];
});
@@ -0,0 +1,9 @@
<?php
use Faker\Generator as Faker;
$factory->define(App\SettingCredit::class, function (Faker $faker) {
return [
//
];
});
@@ -0,0 +1,9 @@
<?php
use Faker\Generator as Faker;
$factory->define(App\SettingSupplier::class, function (Faker $faker) {
return [
//
];
});
@@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateTimeLimitsTable extends Migration
class CreateSettingCreditsTable extends Migration
{
/**
* Run the migrations.
@@ -13,7 +13,7 @@ class CreateTimeLimitsTable extends Migration
*/
public function up()
{
Schema::create('time_limits', function (Blueprint $table) {
Schema::create('setting_credits', function (Blueprint $table) {
$table->increments('id');
$table->decimal('rmb_credit_limit');
$table->decimal('usd_credit_limit');
@@ -28,6 +28,6 @@ class CreateTimeLimitsTable extends Migration
*/
public function down()
{
Schema::dropIfExists('time_limits');
Schema::dropIfExists('setting_credits');
}
}
@@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateSettingCIEFBeneficiariesTable extends Migration
class CreateSettingBeneficiariesTable extends Migration
{
/**
* Run the migrations.
@@ -13,8 +13,8 @@ class CreateSettingCIEFBeneficiariesTable extends Migration
*/
public function up()
{
Schema::create('setting_c_i_e_f_beneficiaries', function (Blueprint $table) {
$table->increments('beneficiary_id');
Schema::create('setting_beneficiaries', function (Blueprint $table) {
$table->increments('id');
$table->string('company_name');
$table->string('bank_name');
$table->string('acc_no');
@@ -33,6 +33,6 @@ class CreateSettingCIEFBeneficiariesTable extends Migration
*/
public function down()
{
Schema::dropIfExists('setting_c_i_e_f_beneficiaries');
Schema::dropIfExists('setting_beneficiaries');
}
}
+132
View File
@@ -1,6 +1,10 @@
<?php
use Illuminate\Http\Request;
Use App\Rate;
Use App\SettingBeneficiary;
Use App\SettingCredit;
Use App\SettingSupplier;
/*
|--------------------------------------------------------------------------
@@ -17,3 +21,131 @@ Route::middleware('auth:api')->get('/user', function (Request $request) {
return $request->user();
});
Route::get('update-rate', 'RateController@index');
Route::get('update-rate/{rate}', 'RateController@show');
Route::post('update-rate', 'RateController@store');
Route::put('update-rate/{rate}', 'RateController@update');
Route::delete('update-rate/{rate}', 'RateController@delete');
Route::get('setting-beneficiary', 'SettingBeneficiaryController@index');
Route::get('setting-beneficiary/{beneficiary}', 'SettingBeneficiaryController@show');
Route::post('setting-beneficiary', 'SettingBeneficiaryController@store');
Route::put('setting-beneficiary/{beneficiary}', 'SettingBeneficiaryController@update');
Route::delete('setting-beneficiary/{beneficiary}', 'SettingBeneficiaryController@delete');
Route::get('setting-credit', 'SettingCreditController@index');
Route::get('setting-credit/{credit}', 'SettingCreditController@show');
Route::post('setting-credit', 'SettingCreditController@store');
Route::put('setting-credit/{credit}', 'SettingCreditController@update');
Route::delete('setting-credit/{credit}', 'SettingCreditController@delete');
Route::get('setting-supplier', 'SettingSupplierController@index');
Route::get('setting-supplier/{supplier}', 'SettingSupplierController@show');
Route::post('setting-supplier', 'SettingSupplierController@store');
Route::put('setting-supplier/{supplier}', 'SettingSupplierController@update');
Route::delete('setting-supplier/{supplier}', 'SettingSupplierController@delete');
/*
//FOR UPDATE RATE
Route::get('update-rate', function() {
// If the Content-Type and Accept headers are set to 'application/json',
// this will return a JSON structure. This will be cleaned up later.
return Rate::all();
});
Route::get('update-rate/{id}', function($id) {
return Rate::find($id);
});
Route::post('update-rate', function(Request $request) {
return Rate::create($request->all);
});
Route::put('update-rate/{id}', function(Request $request, $id) {
$rate = Rate::findOrFail($id);
$rate->update($request->all());
return $rate;
});
//FOR SETTING BENEFICIARY
Route::get('setting-beneficiary', function() {
// If the Content-Type and Accept headers are set to 'application/json',
// this will return a JSON structure. This will be cleaned up later.
return SettingBeneficiary::all();
});
Route::get('setting-beneficiary/{id}', function($id) {
return SettingBeneficiary::find($id);
});
Route::post('setting-beneficiary', function(Request $request) {
return SettingBeneficiary::create($request->all);
});
Route::put('setting-beneficiary/{id}', function(Request $request, $id) {
$beneficiary = SettingBeneficiary::findOrFail($id);
$beneficiary->update($request->all());
return $beneficiary;
});
Route::delete('setting-beneficiary/{id}', function($id) {
SettingBeneficiary::find($id)->delete();
return 204;
});
//FOR SETTING CREDIT
Route::get('setting-credit', function() {
// If the Content-Type and Accept headers are set to 'application/json',
// this will return a JSON structure. This will be cleaned up later.
return SettingCredit::all();
});
Route::get('setting-credit/{id}', function($id) {
return SettingCredit::find($id);
});
Route::post('setting-credit', function(Request $request) {
return SettingCredit::create($request->all);
});
Route::put('setting-credit/{id}', function(Request $request, $id) {
$credit = SettingCredit::findOrFail($id);
$credit->update($request->all());
return $credit;
});
//FOR SETTING SUPPLIER
Route::get('setting-supplier', function() {
// If the Content-Type and Accept headers are set to 'application/json',
// this will return a JSON structure. This will be cleaned up later.
return SettingSupplier::all();
});
Route::get('setting-supplier/{id}', function($id) {
return SettingSupplier::find($id);
});
Route::post('setting-supplier', function(Request $request) {
return SettingSupplier::create($request->all);
});
Route::put('setting-supplier/{id}', function(Request $request, $id) {
$supplier = SettingSupplier::findOrFail($id);
$supplier->update($request->all());
return $supplier;
});
Route::delete('setting-supplier/{id}', function($id) {
SettingSupplier::find($id)->delete();
return 204;
});
*/
+12 -2
View File
@@ -13,6 +13,9 @@ return array(
'App\\Http\\Controllers\\Auth\\RegisterController' => $baseDir . '/app/Http/Controllers/Auth/RegisterController.php',
'App\\Http\\Controllers\\Auth\\ResetPasswordController' => $baseDir . '/app/Http/Controllers/Auth/ResetPasswordController.php',
'App\\Http\\Controllers\\Controller' => $baseDir . '/app/Http/Controllers/Controller.php',
'App\\Http\\Controllers\\RateController' => $baseDir . '/app/Http/Controllers/RateController.php',
'App\\Http\\Controllers\\SettingCreditController' => $baseDir . '/app/Http/Controllers/SettingCreditController.php',
'App\\Http\\Controllers\\SettingSupplierController' => $baseDir . '/app/Http/Controllers/SettingSupplierController.php',
'App\\Http\\Kernel' => $baseDir . '/app/Http/Kernel.php',
'App\\Http\\Middleware\\EncryptCookies' => $baseDir . '/app/Http/Middleware/EncryptCookies.php',
'App\\Http\\Middleware\\RedirectIfAuthenticated' => $baseDir . '/app/Http/Middleware/RedirectIfAuthenticated.php',
@@ -25,14 +28,21 @@ return array(
'App\\Providers\\EventServiceProvider' => $baseDir . '/app/Providers/EventServiceProvider.php',
'App\\Providers\\RouteServiceProvider' => $baseDir . '/app/Providers/RouteServiceProvider.php',
'App\\Rate' => $baseDir . '/app/Rate.php',
'App\\SettingCIEFBeneficiary' => $baseDir . '/app/SettingCIEFBeneficiary.php',
'App\\SettingBeneficiary' => $baseDir . '/app/SettingBeneficiary.php',
'App\\SettingCredit' => $baseDir . '/app/SettingCredit.php',
'App\\SettingSupplier' => $baseDir . '/app/SettingSupplier.php',
'App\\TimeLimit' => $baseDir . '/app/TimeLimit.php',
'App\\User' => $baseDir . '/app/User.php',
'Carbon\\Carbon' => $vendorDir . '/nesbot/carbon/src/Carbon/Carbon.php',
'Carbon\\CarbonInterval' => $vendorDir . '/nesbot/carbon/src/Carbon/CarbonInterval.php',
'Carbon\\Exceptions\\InvalidDateException' => $vendorDir . '/nesbot/carbon/src/Carbon/Exceptions/InvalidDateException.php',
'Carbon\\Translator' => $vendorDir . '/nesbot/carbon/src/Carbon/Translator.php',
'Collective\\Html\\Componentable' => $vendorDir . '/laravelcollective/html/src/Componentable.php',
'Collective\\Html\\Eloquent\\FormAccessible' => $vendorDir . '/laravelcollective/html/src/Eloquent/FormAccessible.php',
'Collective\\Html\\FormBuilder' => $vendorDir . '/laravelcollective/html/src/FormBuilder.php',
'Collective\\Html\\FormFacade' => $vendorDir . '/laravelcollective/html/src/FormFacade.php',
'Collective\\Html\\HtmlBuilder' => $vendorDir . '/laravelcollective/html/src/HtmlBuilder.php',
'Collective\\Html\\HtmlFacade' => $vendorDir . '/laravelcollective/html/src/HtmlFacade.php',
'Collective\\Html\\HtmlServiceProvider' => $vendorDir . '/laravelcollective/html/src/HtmlServiceProvider.php',
'Cron\\AbstractField' => $vendorDir . '/dragonmantank/cron-expression/src/Cron/AbstractField.php',
'Cron\\CronExpression' => $vendorDir . '/dragonmantank/cron-expression/src/Cron/CronExpression.php',
'Cron\\DayOfMonthField' => $vendorDir . '/dragonmantank/cron-expression/src/Cron/DayOfMonthField.php',
+1
View File
@@ -15,4 +15,5 @@ return array(
'58571171fd5812e6e447dce228f52f4d' => $vendorDir . '/laravel/framework/src/Illuminate/Support/helpers.php',
'6124b4c8570aa390c21fafd04a26c69f' => $vendorDir . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php',
'e7223560d890eab89cda23685e711e2c' => $vendorDir . '/psy/psysh/src/Psy/functions.php',
'f18cc91337d49233e5754e93f3ed9ec3' => $vendorDir . '/laravelcollective/html/src/helpers.php',
);
+1
View File
@@ -44,6 +44,7 @@ return array(
'Doctrine\\Common\\Inflector\\' => array($vendorDir . '/doctrine/inflector/lib/Doctrine/Common/Inflector'),
'DeepCopy\\' => array($vendorDir . '/myclabs/deep-copy/src/DeepCopy'),
'Cron\\' => array($vendorDir . '/dragonmantank/cron-expression/src/Cron'),
'Collective\\Html\\' => array($vendorDir . '/laravelcollective/html/src'),
'Carbon\\' => array($vendorDir . '/nesbot/carbon/src/Carbon'),
'App\\' => array($baseDir . '/app'),
);
+18 -2
View File
@@ -16,6 +16,7 @@ class ComposerStaticInitd0143684cbb8cb41ee360a72b2c4ce33
'58571171fd5812e6e447dce228f52f4d' => __DIR__ . '/..' . '/laravel/framework/src/Illuminate/Support/helpers.php',
'6124b4c8570aa390c21fafd04a26c69f' => __DIR__ . '/..' . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php',
'e7223560d890eab89cda23685e711e2c' => __DIR__ . '/..' . '/psy/psysh/src/Psy/functions.php',
'f18cc91337d49233e5754e93f3ed9ec3' => __DIR__ . '/..' . '/laravelcollective/html/src/helpers.php',
);
public static $prefixLengthsPsr4 = array (
@@ -101,6 +102,7 @@ class ComposerStaticInitd0143684cbb8cb41ee360a72b2c4ce33
'C' =>
array (
'Cron\\' => 5,
'Collective\\Html\\' => 16,
'Carbon\\' => 7,
),
'A' =>
@@ -264,6 +266,10 @@ class ComposerStaticInitd0143684cbb8cb41ee360a72b2c4ce33
array (
0 => __DIR__ . '/..' . '/dragonmantank/cron-expression/src/Cron',
),
'Collective\\Html\\' =>
array (
0 => __DIR__ . '/..' . '/laravelcollective/html/src',
),
'Carbon\\' =>
array (
0 => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon',
@@ -321,6 +327,9 @@ class ComposerStaticInitd0143684cbb8cb41ee360a72b2c4ce33
'App\\Http\\Controllers\\Auth\\RegisterController' => __DIR__ . '/../..' . '/app/Http/Controllers/Auth/RegisterController.php',
'App\\Http\\Controllers\\Auth\\ResetPasswordController' => __DIR__ . '/../..' . '/app/Http/Controllers/Auth/ResetPasswordController.php',
'App\\Http\\Controllers\\Controller' => __DIR__ . '/../..' . '/app/Http/Controllers/Controller.php',
'App\\Http\\Controllers\\RateController' => __DIR__ . '/../..' . '/app/Http/Controllers/RateController.php',
'App\\Http\\Controllers\\SettingCreditController' => __DIR__ . '/../..' . '/app/Http/Controllers/SettingCreditController.php',
'App\\Http\\Controllers\\SettingSupplierController' => __DIR__ . '/../..' . '/app/Http/Controllers/SettingSupplierController.php',
'App\\Http\\Kernel' => __DIR__ . '/../..' . '/app/Http/Kernel.php',
'App\\Http\\Middleware\\EncryptCookies' => __DIR__ . '/../..' . '/app/Http/Middleware/EncryptCookies.php',
'App\\Http\\Middleware\\RedirectIfAuthenticated' => __DIR__ . '/../..' . '/app/Http/Middleware/RedirectIfAuthenticated.php',
@@ -333,14 +342,21 @@ class ComposerStaticInitd0143684cbb8cb41ee360a72b2c4ce33
'App\\Providers\\EventServiceProvider' => __DIR__ . '/../..' . '/app/Providers/EventServiceProvider.php',
'App\\Providers\\RouteServiceProvider' => __DIR__ . '/../..' . '/app/Providers/RouteServiceProvider.php',
'App\\Rate' => __DIR__ . '/../..' . '/app/Rate.php',
'App\\SettingCIEFBeneficiary' => __DIR__ . '/../..' . '/app/SettingCIEFBeneficiary.php',
'App\\SettingBeneficiary' => __DIR__ . '/../..' . '/app/SettingBeneficiary.php',
'App\\SettingCredit' => __DIR__ . '/../..' . '/app/SettingCredit.php',
'App\\SettingSupplier' => __DIR__ . '/../..' . '/app/SettingSupplier.php',
'App\\TimeLimit' => __DIR__ . '/../..' . '/app/TimeLimit.php',
'App\\User' => __DIR__ . '/../..' . '/app/User.php',
'Carbon\\Carbon' => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon/Carbon.php',
'Carbon\\CarbonInterval' => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon/CarbonInterval.php',
'Carbon\\Exceptions\\InvalidDateException' => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon/Exceptions/InvalidDateException.php',
'Carbon\\Translator' => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon/Translator.php',
'Collective\\Html\\Componentable' => __DIR__ . '/..' . '/laravelcollective/html/src/Componentable.php',
'Collective\\Html\\Eloquent\\FormAccessible' => __DIR__ . '/..' . '/laravelcollective/html/src/Eloquent/FormAccessible.php',
'Collective\\Html\\FormBuilder' => __DIR__ . '/..' . '/laravelcollective/html/src/FormBuilder.php',
'Collective\\Html\\FormFacade' => __DIR__ . '/..' . '/laravelcollective/html/src/FormFacade.php',
'Collective\\Html\\HtmlBuilder' => __DIR__ . '/..' . '/laravelcollective/html/src/HtmlBuilder.php',
'Collective\\Html\\HtmlFacade' => __DIR__ . '/..' . '/laravelcollective/html/src/HtmlFacade.php',
'Collective\\Html\\HtmlServiceProvider' => __DIR__ . '/..' . '/laravelcollective/html/src/HtmlServiceProvider.php',
'Cron\\AbstractField' => __DIR__ . '/..' . '/dragonmantank/cron-expression/src/Cron/AbstractField.php',
'Cron\\CronExpression' => __DIR__ . '/..' . '/dragonmantank/cron-expression/src/Cron/CronExpression.php',
'Cron\\DayOfMonthField' => __DIR__ . '/..' . '/dragonmantank/cron-expression/src/Cron/DayOfMonthField.php',
+70
View File
@@ -891,6 +891,76 @@
"psysh"
]
},
{
"name": "laravelcollective/html",
"version": "v5.6.6",
"version_normalized": "5.6.6.0",
"source": {
"type": "git",
"url": "https://github.com/LaravelCollective/html.git",
"reference": "b3a10245c791a211e5f8ec37117f4549cd22aabe"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/LaravelCollective/html/zipball/b3a10245c791a211e5f8ec37117f4549cd22aabe",
"reference": "b3a10245c791a211e5f8ec37117f4549cd22aabe",
"shasum": ""
},
"require": {
"illuminate/http": "5.6.*",
"illuminate/routing": "5.6.*",
"illuminate/session": "5.6.*",
"illuminate/support": "5.6.*",
"illuminate/view": "5.6.*",
"php": ">=7.1.3"
},
"require-dev": {
"illuminate/database": "5.6.*",
"mockery/mockery": "~1.0",
"phpunit/phpunit": "~5.4"
},
"time": "2018-04-09T14:09:32+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.6-dev"
},
"laravel": {
"providers": [
"Collective\\Html\\HtmlServiceProvider"
],
"aliases": {
"Form": "Collective\\Html\\FormFacade",
"Html": "Collective\\Html\\HtmlFacade"
}
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Collective\\Html\\": "src/"
},
"files": [
"src/helpers.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Taylor Otwell",
"email": "taylorotwell@gmail.com"
},
{
"name": "Adam Engebretson",
"email": "adam@laravelcollective.com"
}
],
"description": "HTML and Form Builders for the Laravel Framework",
"homepage": "https://laravelcollective.com"
},
{
"name": "league/flysystem",
"version": "1.0.44",
+3
View File
@@ -0,0 +1,3 @@
# Laravel Contribution Guide
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](http://laravel.com/docs/contributions). Please review the entire guide before sending a pull request.
+21
View File
@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) <Adam Engebretson>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
+57
View File
@@ -0,0 +1,57 @@
{
"name": "laravelcollective/html",
"description": "HTML and Form Builders for the Laravel Framework",
"license": "MIT",
"homepage": "https://laravelcollective.com",
"support": {
"issues": "https://github.com/LaravelCollective/html/issues",
"source": "https://github.com/LaravelCollective/html"
},
"authors": [
{
"name": "Adam Engebretson",
"email": "adam@laravelcollective.com"
},
{
"name": "Taylor Otwell",
"email": "taylorotwell@gmail.com"
}
],
"require": {
"php": ">=7.1.3",
"illuminate/http": "5.6.*",
"illuminate/routing": "5.6.*",
"illuminate/session": "5.6.*",
"illuminate/support": "5.6.*",
"illuminate/view": "5.6.*"
},
"require-dev": {
"illuminate/database": "5.6.*",
"mockery/mockery": "~1.0",
"phpunit/phpunit": "~5.4"
},
"autoload": {
"psr-4": {
"Collective\\Html\\": "src/"
},
"files": [
"src/helpers.php"
]
},
"extra": {
"branch-alias": {
"dev-master": "5.6-dev"
},
"laravel": {
"providers": [
"Collective\\Html\\HtmlServiceProvider"
],
"aliases": {
"Form": "Collective\\Html\\FormFacade",
"Html": "Collective\\Html\\HtmlFacade"
}
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
+9
View File
@@ -0,0 +1,9 @@
# Forms & HTML
[![Build Status](https://travis-ci.org/LaravelCollective/html.svg)](https://travis-ci.org/LaravelCollective/html)
[![Total Downloads](https://poser.pugx.org/LaravelCollective/html/downloads)](https://packagist.org/packages/laravelcollective/html)
[![Latest Stable Version](https://poser.pugx.org/LaravelCollective/html/v/stable.svg)](https://packagist.org/packages/laravelcollective/html)
[![Latest Unstable Version](https://poser.pugx.org/LaravelCollective/html/v/unstable.svg)](https://packagist.org/packages/laravelcollective/html)
[![License](https://poser.pugx.org/LaravelCollective/html/license.svg)](https://packagist.org/packages/laravelcollective/html)
Official documentation for Forms & Html for The Laravel Framework can be found at the [LaravelCollective](http://laravelcollective.com) website.
+110
View File
@@ -0,0 +1,110 @@
<?php
namespace Collective\Html;
use BadMethodCallException;
use Illuminate\Support\HtmlString;
trait Componentable
{
/**
* The registered components.
*
* @var array
*/
protected static $components = [];
/**
* Register a custom component.
*
* @param $name
* @param $view
* @param array $signature
*
* @return void
*/
public static function component($name, $view, array $signature)
{
static::$components[$name] = compact('view', 'signature');
}
/**
* Check if a component is registered.
*
* @param $name
*
* @return bool
*/
public static function hasComponent($name)
{
return isset(static::$components[$name]);
}
/**
* Render a custom component.
*
* @param $name
* @param array $arguments
*
* @return \Illuminate\Contracts\View\View
*/
protected function renderComponent($name, array $arguments)
{
$component = static::$components[$name];
$data = $this->getComponentData($component['signature'], $arguments);
return new HtmlString(
$this->view->make($component['view'], $data)->render()
);
}
/**
* Prepare the component data, while respecting provided defaults.
*
* @param array $signature
* @param array $arguments
*
* @return array
*/
protected function getComponentData(array $signature, array $arguments)
{
$data = [];
$i = 0;
foreach ($signature as $variable => $default) {
// If the "variable" value is actually a numeric key, we can assume that
// no default had been specified for the component argument and we'll
// just use null instead, so that we can treat them all the same.
if (is_numeric($variable)) {
$variable = $default;
$default = null;
}
$data[$variable] = array_get($arguments, $i, $default);
$i++;
}
return $data;
}
/**
* Dynamically handle calls to the class.
*
* @param string $method
* @param array $parameters
*
* @return \Illuminate\Contracts\View\View|mixed
*
* @throws \BadMethodCallException
*/
public function __call($method, $parameters)
{
if (static::hasComponent($method)) {
return $this->renderComponent($method, $parameters);
}
throw new BadMethodCallException("Method {$method} does not exist.");
}
}
@@ -0,0 +1,119 @@
<?php
namespace Collective\Html\Eloquent;
use ReflectionClass;
use ReflectionMethod;
use Illuminate\Support\Str;
trait FormAccessible
{
/**
* A cached ReflectionClass instance for $this
*
* @var ReflectionClass
*/
protected $reflection;
/**
* @param string $key
*
* @return mixed
*/
public function getFormValue($key)
{
$value = $this->getAttributeFromArray($key);
// If the attribute is listed as a date, we will convert it to a DateTime
// instance on retrieval, which makes it quite convenient to work with
// date fields without having to create a mutator for each property.
if (in_array($key, $this->getDates())) {
if (! is_null($value)) {
$value = $this->asDateTime($value);
}
}
// If the attribute has a get mutator, we will call that then return what
// it returns as the value, which is useful for transforming values on
// retrieval from the model to a form that is more useful for usage.
if ($this->hasFormMutator($key)) {
return $this->mutateFormAttribute($key, $value);
}
$keys = explode('.', $key);
if ($this->isNestedModel($keys[0])) {
$relatedModel = $this->getRelation($keys[0]);
unset($keys[0]);
$key = implode('.', $keys);
if (method_exists($relatedModel, 'hasFormMutator') && $key !== '' && $relatedModel->hasFormMutator($key)) {
return $relatedModel->getFormValue($key);
}
return data_get($relatedModel, empty($key)? null: $key);
}
// No form mutator, let the model resolve this
return data_get($this, $key);
}
/**
* Check for a nested model.
*
* @param string $key
*
* @return bool
*/
public function isNestedModel($key)
{
if (in_array($key, array_keys($this->getRelations()))) {
return true;
}
return false;
}
/**
* @param $key
*
* @return bool
*/
public function hasFormMutator($key)
{
$methods = $this->getReflection()->getMethods(ReflectionMethod::IS_PUBLIC);
$mutator = collect($methods)
->first(function (ReflectionMethod $method) use ($key) {
return $method->getName() === 'form' . Str::studly($key) . 'Attribute';
});
return (bool) $mutator;
}
/**
* @param $key
* @param $value
*
* @return mixed
*/
private function mutateFormAttribute($key, $value)
{
return $this->{'form' . Str::studly($key) . 'Attribute'}($value);
}
/**
* Get a ReflectionClass Instance
* @return ReflectionClass
*/
protected function getReflection()
{
if (! $this->reflection) {
$this->reflection = new ReflectionClass($this);
}
return $this->reflection;
}
}
File diff suppressed because it is too large Load Diff
+22
View File
@@ -0,0 +1,22 @@
<?php
namespace Collective\Html;
use Illuminate\Support\Facades\Facade;
/**
* @see \Collective\Html\FormBuilder
*/
class FormFacade extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'form';
}
}
+566
View File
@@ -0,0 +1,566 @@
<?php
namespace Collective\Html;
use BadMethodCallException;
use Illuminate\Support\HtmlString;
use Illuminate\Contracts\View\Factory;
use Illuminate\Support\Traits\Macroable;
use Illuminate\Contracts\Routing\UrlGenerator;
class HtmlBuilder
{
use Macroable, Componentable {
Macroable::__call as macroCall;
Componentable::__call as componentCall;
}
/**
* The URL generator instance.
*
* @var \Illuminate\Contracts\Routing\UrlGenerator
*/
protected $url;
/**
* The View Factory instance.
*
* @var \Illuminate\Contracts\View\Factory
*/
protected $view;
/**
* Create a new HTML builder instance.
*
* @param \Illuminate\Contracts\Routing\UrlGenerator $url
* @param \Illuminate\Contracts\View\Factory $view
*/
public function __construct(UrlGenerator $url = null, Factory $view)
{
$this->url = $url;
$this->view = $view;
}
/**
* Convert an HTML string to entities.
*
* @param string $value
*
* @return string
*/
public function entities($value)
{
return htmlentities($value, ENT_QUOTES, 'UTF-8', false);
}
/**
* Convert entities to HTML characters.
*
* @param string $value
*
* @return string
*/
public function decode($value)
{
return html_entity_decode($value, ENT_QUOTES, 'UTF-8');
}
/**
* Generate a link to a JavaScript file.
*
* @param string $url
* @param array $attributes
* @param bool $secure
*
* @return \Illuminate\Support\HtmlString
*/
public function script($url, $attributes = [], $secure = null)
{
$attributes['src'] = $this->url->asset($url, $secure);
return $this->toHtmlString('<script' . $this->attributes($attributes) . '></script>');
}
/**
* Generate a link to a CSS file.
*
* @param string $url
* @param array $attributes
* @param bool $secure
*
* @return \Illuminate\Support\HtmlString
*/
public function style($url, $attributes = [], $secure = null)
{
$defaults = ['media' => 'all', 'type' => 'text/css', 'rel' => 'stylesheet'];
$attributes = array_merge($defaults, $attributes);
$attributes['href'] = $this->url->asset($url, $secure);
return $this->toHtmlString('<link' . $this->attributes($attributes) . '>');
}
/**
* Generate an HTML image element.
*
* @param string $url
* @param string $alt
* @param array $attributes
* @param bool $secure
*
* @return \Illuminate\Support\HtmlString
*/
public function image($url, $alt = null, $attributes = [], $secure = null)
{
$attributes['alt'] = $alt;
return $this->toHtmlString('<img src="' . $this->url->asset($url,
$secure) . '"' . $this->attributes($attributes) . '>');
}
/**
* Generate a link to a Favicon file.
*
* @param string $url
* @param array $attributes
* @param bool $secure
*
* @return \Illuminate\Support\HtmlString
*/
public function favicon($url, $attributes = [], $secure = null)
{
$defaults = ['rel' => 'shortcut icon', 'type' => 'image/x-icon'];
$attributes = array_merge($attributes, $defaults);
$attributes['href'] = $this->url->asset($url, $secure);
return $this->toHtmlString('<link' . $this->attributes($attributes) . '>');
}
/**
* Generate a HTML link.
*
* @param string $url
* @param string $title
* @param array $attributes
* @param bool $secure
* @param bool $escape
*
* @return \Illuminate\Support\HtmlString
*/
public function link($url, $title = null, $attributes = [], $secure = null, $escape = true)
{
$url = $this->url->to($url, [], $secure);
if (is_null($title) || $title === false) {
$title = $url;
}
if ($escape) {
$title = $this->entities($title);
}
return $this->toHtmlString('<a href="' . $this->entities($url) . '"' . $this->attributes($attributes) . '>' . $title . '</a>');
}
/**
* Generate a HTTPS HTML link.
*
* @param string $url
* @param string $title
* @param array $attributes
*
* @return \Illuminate\Support\HtmlString
*/
public function secureLink($url, $title = null, $attributes = [])
{
return $this->link($url, $title, $attributes, true);
}
/**
* Generate a HTML link to an asset.
*
* @param string $url
* @param string $title
* @param array $attributes
* @param bool $secure
*
* @return \Illuminate\Support\HtmlString
*/
public function linkAsset($url, $title = null, $attributes = [], $secure = null)
{
$url = $this->url->asset($url, $secure);
return $this->link($url, $title ?: $url, $attributes, $secure);
}
/**
* Generate a HTTPS HTML link to an asset.
*
* @param string $url
* @param string $title
* @param array $attributes
*
* @return \Illuminate\Support\HtmlString
*/
public function linkSecureAsset($url, $title = null, $attributes = [])
{
return $this->linkAsset($url, $title, $attributes, true);
}
/**
* Generate a HTML link to a named route.
*
* @param string $name
* @param string $title
* @param array $parameters
* @param array $attributes
*
* @return \Illuminate\Support\HtmlString
*/
public function linkRoute($name, $title = null, $parameters = [], $attributes = [])
{
return $this->link($this->url->route($name, $parameters), $title, $attributes);
}
/**
* Generate a HTML link to a controller action.
*
* @param string $action
* @param string $title
* @param array $parameters
* @param array $attributes
*
* @return \Illuminate\Support\HtmlString
*/
public function linkAction($action, $title = null, $parameters = [], $attributes = [])
{
return $this->link($this->url->action($action, $parameters), $title, $attributes);
}
/**
* Generate a HTML link to an email address.
*
* @param string $email
* @param string $title
* @param array $attributes
* @param bool $escape
*
* @return \Illuminate\Support\HtmlString
*/
public function mailto($email, $title = null, $attributes = [], $escape = true)
{
$email = $this->email($email);
$title = $title ?: $email;
if ($escape) {
$title = $this->entities($title);
}
$email = $this->obfuscate('mailto:') . $email;
return $this->toHtmlString('<a href="' . $email . '"' . $this->attributes($attributes) . '>' . $title . '</a>');
}
/**
* Obfuscate an e-mail address to prevent spam-bots from sniffing it.
*
* @param string $email
*
* @return string
*/
public function email($email)
{
return str_replace('@', '&#64;', $this->obfuscate($email));
}
/**
* Generates non-breaking space entities based on number supplied.
*
* @param int $num
*
* @return string
*/
public function nbsp($num = 1)
{
return str_repeat('&nbsp;', $num);
}
/**
* Generate an ordered list of items.
*
* @param array $list
* @param array $attributes
*
* @return \Illuminate\Support\HtmlString|string
*/
public function ol($list, $attributes = [])
{
return $this->listing('ol', $list, $attributes);
}
/**
* Generate an un-ordered list of items.
*
* @param array $list
* @param array $attributes
*
* @return \Illuminate\Support\HtmlString|string
*/
public function ul($list, $attributes = [])
{
return $this->listing('ul', $list, $attributes);
}
/**
* Generate a description list of items.
*
* @param array $list
* @param array $attributes
*
* @return \Illuminate\Support\HtmlString
*/
public function dl(array $list, array $attributes = [])
{
$attributes = $this->attributes($attributes);
$html = "<dl{$attributes}>";
foreach ($list as $key => $value) {
$value = (array) $value;
$html .= "<dt>$key</dt>";
foreach ($value as $v_key => $v_value) {
$html .= "<dd>$v_value</dd>";
}
}
$html .= '</dl>';
return $this->toHtmlString($html);
}
/**
* Create a listing HTML element.
*
* @param string $type
* @param array $list
* @param array $attributes
*
* @return \Illuminate\Support\HtmlString|string
*/
protected function listing($type, $list, $attributes = [])
{
$html = '';
if (count($list) === 0) {
return $html;
}
// Essentially we will just spin through the list and build the list of the HTML
// elements from the array. We will also handled nested lists in case that is
// present in the array. Then we will build out the final listing elements.
foreach ($list as $key => $value) {
$html .= $this->listingElement($key, $type, $value);
}
$attributes = $this->attributes($attributes);
return $this->toHtmlString("<{$type}{$attributes}>{$html}</{$type}>");
}
/**
* Create the HTML for a listing element.
*
* @param mixed $key
* @param string $type
* @param mixed $value
*
* @return string
*/
protected function listingElement($key, $type, $value)
{
if (is_array($value)) {
return $this->nestedListing($key, $type, $value);
} else {
return '<li>' . e($value, false) . '</li>';
}
}
/**
* Create the HTML for a nested listing attribute.
*
* @param mixed $key
* @param string $type
* @param mixed $value
*
* @return string
*/
protected function nestedListing($key, $type, $value)
{
if (is_int($key)) {
return $this->listing($type, $value);
} else {
return '<li>' . $key . $this->listing($type, $value) . '</li>';
}
}
/**
* Build an HTML attribute string from an array.
*
* @param array $attributes
*
* @return string
*/
public function attributes($attributes)
{
$html = [];
foreach ((array) $attributes as $key => $value) {
$element = $this->attributeElement($key, $value);
if (! is_null($element)) {
$html[] = $element;
}
}
return count($html) > 0 ? ' ' . implode(' ', $html) : '';
}
/**
* Build a single attribute element.
*
* @param string $key
* @param string $value
*
* @return string
*/
protected function attributeElement($key, $value)
{
// For numeric keys we will assume that the value is a boolean attribute
// where the presence of the attribute represents a true value and the
// absence represents a false value.
// This will convert HTML attributes such as "required" to a correct
// form instead of using incorrect numerics.
if (is_numeric($key)) {
return $value;
}
// Treat boolean attributes as HTML properties
if (is_bool($value) && $key !== 'value') {
return $value ? $key : '';
}
if (! is_null($value)) {
return $key . '="' . e($value, false) . '"';
}
}
/**
* Obfuscate a string to prevent spam-bots from sniffing it.
*
* @param string $value
*
* @return string
*/
public function obfuscate($value)
{
$safe = '';
foreach (str_split($value) as $letter) {
if (ord($letter) > 128) {
return $letter;
}
// To properly obfuscate the value, we will randomly convert each letter to
// its entity or hexadecimal representation, keeping a bot from sniffing
// the randomly obfuscated letters out of the string on the responses.
switch (rand(1, 3)) {
case 1:
$safe .= '&#' . ord($letter) . ';';
break;
case 2:
$safe .= '&#x' . dechex(ord($letter)) . ';';
break;
case 3:
$safe .= $letter;
}
}
return $safe;
}
/**
* Generate a meta tag.
*
* @param string $name
* @param string $content
* @param array $attributes
*
* @return \Illuminate\Support\HtmlString
*/
public function meta($name, $content, array $attributes = [])
{
$defaults = compact('name', 'content');
$attributes = array_merge($defaults, $attributes);
return $this->toHtmlString('<meta' . $this->attributes($attributes) . '>');
}
/**
* Generate an html tag.
*
* @param string $tag
* @param mixed $content
* @param array $attributes
*
* @return \Illuminate\Support\HtmlString
*/
public function tag($tag, $content, array $attributes = [])
{
$content = is_array($content) ? implode('', $content) : $content;
return $this->toHtmlString('<' . $tag . $this->attributes($attributes) . '>' . $this->toHtmlString($content) . '</' . $tag . '>');
}
/**
* Transform the string to an Html serializable object
*
* @param $html
*
* @return \Illuminate\Support\HtmlString
*/
protected function toHtmlString($html)
{
return new HtmlString($html);
}
/**
* Dynamically handle calls to the class.
*
* @param string $method
* @param array $parameters
*
* @return \Illuminate\Contracts\View\View|mixed
*
* @throws \BadMethodCallException
*/
public function __call($method, $parameters)
{
if (static::hasComponent($method)) {
return $this->componentCall($method, $parameters);
}
if (static::hasMacro($method)) {
return $this->macroCall($method, $parameters);
}
throw new BadMethodCallException("Method {$method} does not exist.");
}
}
+22
View File
@@ -0,0 +1,22 @@
<?php
namespace Collective\Html;
use Illuminate\Support\Facades\Facade;
/**
* @see \Collective\Html\HtmlBuilder
*/
class HtmlFacade extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'html';
}
}
+107
View File
@@ -0,0 +1,107 @@
<?php
namespace Collective\Html;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Str;
use Illuminate\View\Compilers\BladeCompiler;
class HtmlServiceProvider extends ServiceProvider
{
/**
* Supported Blade Directives
*
* @var array
*/
protected $directives = ['entities','decode','script','style','image','favicon','link','secureLink','linkAsset','linkSecureAsset','linkRoute','linkAction','mailto','email','ol','ul','dl','meta','tag','open','model','close','token','label','input','text','password','hidden','email','tel','number','date','datetime','datetimeLocal','time','url','file','textarea','select','selectRange','selectYear','selectMonth','getSelectOption','checkbox','radio','reset','image','color','submit','button','old'
];
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = true;
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->registerHtmlBuilder();
$this->registerFormBuilder();
$this->app->alias('html', HtmlBuilder::class);
$this->app->alias('form', FormBuilder::class);
$this->registerBladeDirectives();
}
/**
* Register the HTML builder instance.
*
* @return void
*/
protected function registerHtmlBuilder()
{
$this->app->singleton('html', function ($app) {
return new HtmlBuilder($app['url'], $app['view']);
});
}
/**
* Register the form builder instance.
*
* @return void
*/
protected function registerFormBuilder()
{
$this->app->singleton('form', function ($app) {
$form = new FormBuilder($app['html'], $app['url'], $app['view'], $app['session.store']->token(), $app['request']);
return $form->setSessionStore($app['session.store']);
});
}
/**
* Register Blade directives.
*
* @return void
*/
protected function registerBladeDirectives()
{
$this->app->afterResolving('blade.compiler', function (BladeCompiler $bladeCompiler) {
$namespaces = [
'Html' => get_class_methods(HtmlBuilder::class),
'Form' => get_class_methods(FormBuilder::class),
];
foreach ($namespaces as $namespace => $methods) {
foreach ($methods as $method) {
if (in_array($method, $this->directives)) {
$snakeMethod = Str::snake($method);
$directive = strtolower($namespace).'_'.$snakeMethod;
$bladeCompiler->directive($directive, function ($expression) use ($namespace, $method) {
return "<?php echo $namespace::$method($expression); ?>";
});
}
}
}
});
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return ['html', 'form', HtmlBuilder::class, FormBuilder::class];
}
}
+70
View File
@@ -0,0 +1,70 @@
<?php
if (! function_exists('link_to')) {
/**
* Generate a HTML link.
*
* @param string $url
* @param string $title
* @param array $attributes
* @param bool $secure
* @param bool $escape
*
* @return string
*/
function link_to($url, $title = null, $attributes = [], $secure = null, $escape = true)
{
return app('html')->link($url, $title, $attributes, $secure, $escape);
}
}
if (! function_exists('link_to_asset')) {
/**
* Generate a HTML link to an asset.
*
* @param string $url
* @param string $title
* @param array $attributes
* @param bool $secure
*
* @return string
*/
function link_to_asset($url, $title = null, $attributes = [], $secure = null)
{
return app('html')->linkAsset($url, $title, $attributes, $secure);
}
}
if (! function_exists('link_to_route')) {
/**
* Generate a HTML link to a named route.
*
* @param string $name
* @param string $title
* @param array $parameters
* @param array $attributes
*
* @return string
*/
function link_to_route($name, $title = null, $parameters = [], $attributes = [])
{
return app('html')->linkRoute($name, $title, $parameters, $attributes);
}
}
if (! function_exists('link_to_action')) {
/**
* Generate a HTML link to a controller action.
*
* @param string $action
* @param string $title
* @param array $parameters
* @param array $attributes
*
* @return string
*/
function link_to_action($action, $title = null, $parameters = [], $attributes = [])
{
return app('html')->linkAction($action, $title, $parameters, $attributes);
}
}