From 3242ae9cbedae04bd03a92a929a01337a569fcef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Sat, 21 Jul 2018 18:06:37 +0200 Subject: [PATCH] new table form html, css --- app/Facades/WidgetFacade.php | 15 + app/Http/Controllers/HomeController.php | 10 - app/Http/Controllers/TableController.php | 20 +- app/Providers/AppServiceProvider.php | 5 +- app/Providers/RouteServiceProvider.php | 6 +- app/View/Widget.php | 108 +++++++ app/View/WidgetFactory.php | 27 ++ config/app.php | 1 + public/fonts/fa-dtbl-1-preview.html | 386 +++++++++++++++++++++++ public/fonts/fa-dtbl-1.css | 19 +- public/fonts/fa-dtbl-1.eot | Bin 3772 -> 4804 bytes public/fonts/fa-dtbl-1.svg | 37 ++- public/fonts/fa-dtbl-1.ttf | Bin 3592 -> 4624 bytes public/fonts/fa-dtbl-1.woff2 | Bin 1772 -> 2296 bytes resources/assets/js/app.js | 7 + resources/assets/sass/_bst-modules.scss | 4 +- resources/assets/sass/_variables.scss | 4 + resources/assets/sass/app.scss | 12 + resources/views/form/_help.blade.php | 11 + resources/views/form/input.blade.php | 21 ++ resources/views/form/textarea.blade.php | 20 ++ resources/views/table/create.blade.php | 119 +++---- routes/login.php | 1 + routes/public.php | 19 ++ routes/user.php | 13 + routes/web.php | 34 -- 26 files changed, 750 insertions(+), 149 deletions(-) create mode 100644 app/Facades/WidgetFacade.php create mode 100644 app/View/Widget.php create mode 100644 app/View/WidgetFactory.php create mode 100644 public/fonts/fa-dtbl-1-preview.html create mode 100644 resources/views/form/_help.blade.php create mode 100644 resources/views/form/input.blade.php create mode 100644 resources/views/form/textarea.blade.php create mode 100644 routes/public.php create mode 100644 routes/user.php delete mode 100644 routes/web.php diff --git a/app/Facades/WidgetFacade.php b/app/Facades/WidgetFacade.php new file mode 100644 index 0000000..cc1bce1 --- /dev/null +++ b/app/Facades/WidgetFacade.php @@ -0,0 +1,15 @@ +middleware('auth'); - } - /** * Show the application dashboard. * diff --git a/app/Http/Controllers/TableController.php b/app/Http/Controllers/TableController.php index b7c509e..fcfcf4e 100644 --- a/app/Http/Controllers/TableController.php +++ b/app/Http/Controllers/TableController.php @@ -14,9 +14,9 @@ class TableController extends Controller public function create() { $exampleColSpec = - "string, latin, Latin Name\n". - "string, common, Common Name\n". - "int, lifespan, Lifespan"; + "latin, string, Latin Name\n". + "common, string, Common Name\n". + "lifespan, int, Lifespan (years)"; $exampleData = "Mercenaria mercenaria, hard clam, 40\n" . @@ -27,4 +27,18 @@ class TableController extends Controller compact('exampleColSpec', 'exampleData') ); } + + public function storeNew(Request $request) + { + $this->validate($request, [ + 'table-name' => 'required', + 'table-descr' => 'string|nullable', + 'license' => 'string|nullable', + 'upstream' => 'string|nullable', + 'col-spec' => 'required', + 'row-data' => 'string|nullable', + ]); + + return "Ok."; + } } diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 3dc7939..95e9b5f 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -2,6 +2,7 @@ namespace App\Providers; +use App\View\WidgetFactory; use Illuminate\Support\ServiceProvider; class AppServiceProvider extends ServiceProvider @@ -25,6 +26,8 @@ class AppServiceProvider extends ServiceProvider */ public function register() { - // + $this->app->singleton(WidgetFactory::class, function () { + return new WidgetFactory(); + }); } } diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index 5ea48d3..69772c1 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -53,7 +53,11 @@ class RouteServiceProvider extends ServiceProvider { Route::middleware('web') ->namespace($this->namespace) - ->group(base_path('routes/web.php')); + ->group(base_path('routes/public.php')); + + Route::middleware(['web', 'auth']) + ->namespace($this->namespace) + ->group(base_path('routes/user.php')); } /** diff --git a/app/View/Widget.php b/app/View/Widget.php new file mode 100644 index 0000000..41527ab --- /dev/null +++ b/app/View/Widget.php @@ -0,0 +1,108 @@ +id = 'field-'.$name; + $this->name = $name; + $this->label = $label; + $this->viewName = $viewName; + } + + // setting attributes via magic method + public function __call($method, $args) + { + static $cssProps = [ + 'height', 'minHeight', 'maxHeight' + ]; + + if (empty($args)) $args = ['']; + + $arg = $args[0]; + + // css + $lccamel = $method; + if (in_array($lccamel, $cssProps)) { + return $this->css(kebab_case($lccamel), $arg); + } + + if (property_exists($this, $method)) { + $this->$method = $arg; + } + else { + $this->attributes[$method] = $arg; + } + + return $this; + } + + public function css($prop, $val) + { + $this->style[$prop] = $val; + return $this; + } + + public function __get($name) + { + if ($name == 'attributes') { + return $this->compileAttribs(); + } + + if ($name == 'value') { + return old($this->name, $this->value); + } + + if (property_exists($this, $name)) { + return $this->$name; + } + + return null; + } + + public function compileAttribs() + { + // compile attribs string + $attribs_s = array_reduce(array_keys($this->attributes), function ($carry, $key) { + return $carry . ' ' . $key . '="' . e($this->attributes[$key]) . '"'; + }, ''); + + // add a compiled list of styles + if (!empty($this->style)) { + $attribs_s .= 'style="'.trim(e(array_reduce(array_keys($this->style), function ($carry, $key) { + return $carry . $key . ': ' . $this->style[$key] . '; '; + }, ''))).'"'; + } + + return trim($attribs_s); + } + + public function render() + { + return view('form.'.$this->viewName)->with(['w' => $this]); + } + + public function __toString() + { + return (string) $this->render(); + } +} diff --git a/app/View/WidgetFactory.php b/app/View/WidgetFactory.php new file mode 100644 index 0000000..6d08ef7 --- /dev/null +++ b/app/View/WidgetFactory.php @@ -0,0 +1,27 @@ +minHeight('4em'); + } +} diff --git a/config/app.php b/config/app.php index b2b1b29..199b8ff 100644 --- a/config/app.php +++ b/config/app.php @@ -217,6 +217,7 @@ return [ // sideload 'SocialAuth' => AdamWathan\EloquentOAuth\Facades\OAuth::class, + 'Widget' => App\Facades\WidgetFacade::class, ], // -------------- added keys -------------- diff --git a/public/fonts/fa-dtbl-1-preview.html b/public/fonts/fa-dtbl-1-preview.html new file mode 100644 index 0000000..0fa4298 --- /dev/null +++ b/public/fonts/fa-dtbl-1-preview.html @@ -0,0 +1,386 @@ + + + + fa-dtbl-1 glyphs preview + + + + + + + + + +
+
+

fa-dtbl-1 contains 12 glyphs:

+ Toggle Preview Characters +
+ + +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ +
+
+ PpPpPpPpPpPpPpPpPpPp +
+
+ 12141618212436486072 +
+
+ + +
+
+ + + +
+ + diff --git a/public/fonts/fa-dtbl-1.css b/public/fonts/fa-dtbl-1.css index fe8f918..138f940 100644 --- a/public/fonts/fa-dtbl-1.css +++ b/public/fonts/fa-dtbl-1.css @@ -38,10 +38,15 @@ font-smoothing: antialiased; } -.fa-facebook-square::before { content: "\f100"; } -.fa-github::before { content: "\f101"; } -.fa-google::before { content: "\f102"; } -.fa-sign-in::before { content: "\f103"; } -.fa-sign-out::before { content: "\f104"; } -.fa-user-circle-o::before { content: "\f105"; } -.fa-user-plus::before { content: "\f106"; } +.fa-check::before { content: "\f100"; } +.fa-facebook-square::before { content: "\f101"; } +.fa-floppy-o::before, .fa-save::before { content: "\f102"; } +.fa-github::before { content: "\f103"; } +.fa-google::before { content: "\f104"; } +.fa-question-circle::before { content: "\f105"; } +.fa-sign-in::before { content: "\f106"; } +.fa-sign-out::before { content: "\f107"; } +.fa-times::before, .fa-close::before { content: "\f108"; } +.fa-trash-o::before { content: "\f109"; } +.fa-user-circle-o::before { content: "\f10a"; } +.fa-user-plus::before { content: "\f10b"; } diff --git a/public/fonts/fa-dtbl-1.eot b/public/fonts/fa-dtbl-1.eot index 1aedfbad9f4e1df318d4f345685fe527a444896e..3cea9014ad7e56f6a32e6c5181f6b8654636e22b 100644 GIT binary patch delta 1551 zcmaJ>Uuaup6hG(Qn|qVAxyen^wAH&cNt-m%rhn2j4XfM2HmlT8%UWC!smZc5js0`8 zCXvmTTwy{5nQp)zz!~zB z>7`WuUcIGG{(Tzb=~s$g808cI_89S8HdV;i>%da}&*Yo4i|6LP`SRB`;uirdZ_Z~@ zr#;fsL&SYgBQ{Tf_`V=fEjRgH^Gn6E<%w+=CEz9jiA5!yl00I93Oqx;e<^h~4==#y z#K+0^E~l0Ft;7PyPu_0s#Quo~_fS z_U1a6f!AF#Fi^RLp@73kbif+~=|6@B8dw7Q41_a%TyZdmv8gi2gaaZN1@t2NFx`8| z_fli)gsGJa%m_AZ++o7lJ_8rvK7P&cOrEK-z3ei_anEyi04{MaPJ_sc+$Z3nN^SuK z-rtWHj2^~Vq}4*E19?%d^{&d3@~U=Omh}Y&nYVSH{cX~qHsp(VT9C*d^z$u}+cS!h znCYLOMnEg>M^ss;0jsKRtM;RHz#b3PHbZe$jfdDoD6Xk4+osLsI-y&Jzz0MUwH8Xs z*d~Wi)l^m$2d&s{b!$nT!?nKv*Yp(wn4nynrdM$77_2D~iic$FCpo$C71zO(NpQRS zvcmxw0|*Q^dftbPo-sDM`I(0xGo37dAk^gv&+k| zs#Dw)orXbBJ~;WiYHvL+G&?NAK7VxJ+0ek@oI&oxphMh+LpG}IDQP$YF8o{+?B)@p@ujf#Wpgu zGLfgL)apKj+-$kKfv9gr?aEYTS0!lUcr|9qF^lid4}G<68k*B$Kk@q&pC zp+_&Yt2%%1AnK|bIi$yV${k3S0jHSI|0**0h_$+-iguPwuy(PQ#LWT0s@<{*tl|`t zvqyF|kIW|Z0ysQop9o_xF;Y<0dBlxVHnFh z6u)zP>Rf4xy=k;{JrIosuG3SxanjsoVk0nES+Vspk-^HE?P}RU7a8ddVUa-=IW!@U z0-Di+R&2s%w3*WLne>8vE|t!lQj~>o;Y=yDk}=OMD*61mu)=3^#re`HKC39%#f<$- zDN`usl;vnu@ulOhG8Fqzdz4#a61kCO+l|q=&ijj8Qjt NKSYw&-uu^>{|212RX+d# delta 522 zcmYk2KWGzC9LImZcX#hDT$38HMWmq_Y^{*9wv?zuu#`?BD2O0fY%iDV<>)2v%-u;` z%%tF8CA_JVVy6zpAswuA)45ZjB3%j{OE;G;@t1SZ2VZ`CKVN=-ct0lg3VbgIVC1^I ztWK`)6uR?oI^Aa_fb1y%j6HljJ-f2MHV%MK$*(vKJ3Kxg>61Sp-FIHbMX0C(K)Fe| z>e*4)?}I}9l!M^~uU5sEw-MzJ0JNjJYu85A&1;k$k;-)fxlMhDW?dqGwcd!^o!Kp@ z5co=<6bQ%Ge(H-fV2=FdhTRU~34EjcHu+-HZnzua2L#AW(f&#(qWJyvr#o~&jq(mq zGEiY>eR6sD?r$)40sx1t?U8@A4+ijoHGqNqj#Cq6+GxT%LW9Rhn6i1ekrGwgl^57O z`X5Dr(44M`L)^cHF8EYgY6kv0E -Created by FontForge 20170805 at Mon Jul 16 22:14:13 2018 +Created by FontForge 20170805 at Sat Jul 21 17:17:47 2018 By ondra The Fork Awesome font is licensed under the SIL OFL 1.1 (http://scripts.sil.org/OFL). Fork Awesome is a fork based of off Font Awesome 4.7.0 by Dave Gandy. More info on licenses at https://forkawesome.github.io @@ -22,32 +22,49 @@ The Fork Awesome font is licensed under the SIL OFL 1.1 (http://scripts.sil.org/ bbox="0 -256 2048 1536" underline-thickness="89.6" underline-position="-179.2" - unicode-range="U+0020-F106" + unicode-range="U+0020-F10B" /> - + - + - - + - - + + - diff --git a/public/fonts/fa-dtbl-1.ttf b/public/fonts/fa-dtbl-1.ttf index cf3fd691c866352df20ab3384b419208f4902e0b..9fa1282d83d4f8ac1472b3261b6a10ea75dc913c 100644 GIT binary patch delta 1512 zcmaJ>UrbwN6hG(Q+k0uDx7@ZAkUMA#lp5%OQrcz+G}}ajh-45YX2Et{X)AwjM_U8F z^gi&wgVDLh#U(Q%jyNBTF=EVOq9HNy!Nk6p#mIcwlRhk(_$OH=z4hD+(-||FD=9`1DIdSq!Q;{(o;jk z{Xi?6$)rjN@wy;UF((DOGAo7k>Dw?u_$J}lvXV?lE-^+0o+j*FNv!AKMfi;PC}H<% zVkLED>5VEt12x2ra?Y9K`Xr^awJVDtNPw_mb7@dwlk6bATiy+%XnPo~y( z2_r(Ik=a-t!(;eS`7DlOefcT|xN;(A;cyB+VFEozfV6&M_2lAp^?c0)P zc0I1(PB!JNDx(m@_(42QyzF|MnT;oMzJqrJ<`v8r9%6YYjUP~LmtH`Ug>DKs>i zhdtiVz%%}V@vK4i&U)P56CJInRivL|OZp+u<%jC+Xg4L*CnCCeu%Ph?xH^ z3YSwbBe!G7LEG2%504*xG&0N3n-Hv=Wsuq+C-?^aC4oKtJ8PQ;?>+ zMLHl|kXS-t(uGUc#s6W4TgVV{KwJj(Y=wMf=hsu!>!bFPuEsJGl_o3*hjCZQ749|Fmra zhebQ?Jh zUKd(SY!C*^Uo`YF!NKy~hAX8;y2uC&u*e{b9GZ|v0qf9=7Ockxw3?EcRC39-m`JA1 zDaukHf1#LIOVuqdE4kc8K;hHbLZ*0*Pb*4#Ic2+0Oyvt%Wi^n@t|gaKLOz>b4P;mA tjHgm8mNX|_x zc=${7Kal?fh`o}_N)#BZS@Ibem<@pPEa{2G1^@p8O=92$$}@1J=TxTUuWu^`%KI=d zu-?f?O-vDES*#9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=edH096Li>=v)V(Qo#Awkn-?5Ub- zG8*QX+VuArGj5m}gZ7^rpVr@p%x84}CtnZq_C)vHWtzv2)X$$--^qMI_N|?b>K(p+ zz0hmW#fyWyGA1CX_F5RFoVjvl$bjAAZE@s%^?-2~v3hE3i_+p|`udG_pn{s06yWC< zkYw=GAMso$%;+O}qvmma5@O@PJY9f}@ng#0>hcO&v?w?-bkq}Pjx?N=p|(?`voNxi zeqsYXFD`>h;Jp{3R-s#^<--R{<*uE7HI*>Aa#9bb#`}+!if)$Kszlm5cqjxoYA?TU%TX%#RbODY^S(7S+laXIYgZ}r!kFMJ#gO)0Jaju_L{4I7`#i^ z%CUDVOPYc(qK#PSCv)WQZ%lqO0YCuVjxnCC?6SV8c@>(cmasw%4gfNu@D9QKW`O+3A8Vs#OPeqyeLhc!G$;I*`hPGOE#Y z;3g|0*dHB9k^XrNt(@NN4z}9o{S&<2qzWd6flRIWm9c465Z@gul9@vyO6jE<;2Nr4 z-3u?eGW%4D7qliV5$8XD3kd|f{V5^zsU-T#^)-;zRA31Fh-XSy7)1UK@&fT|lY&gC z4h+a9Ofke%heKP;7+G0q%ymg8Z!!o?069yr1$Ka{#>$bcaGhGuXlz3T4J^9!4$fB6 z4!A32DX(yiBI1B>@~Ui~Q3(>CYX+Q@6qZyE>J@9vq|bzaW*p@?h|miDMe>4q@=zr0 wzz~*jL`Bqg;;BICKr~`nG=whJ6b|w*NL$L>td_o%Ao2U)fa2|i3K9SS02)d|=Kufz diff --git a/resources/assets/js/app.js b/resources/assets/js/app.js index ffc5e64..50e0ad6 100644 --- a/resources/assets/js/app.js +++ b/resources/assets/js/app.js @@ -7,6 +7,13 @@ require('./bootstrap'); +$(function () { + $('[data-toggle="tooltip"]').tooltip({ + container: 'body' + }) +}) + + // // window.Vue = require('vue'); // diff --git a/resources/assets/sass/_bst-modules.scss b/resources/assets/sass/_bst-modules.scss index c6548d7..0ee0f65 100644 --- a/resources/assets/sass/_bst-modules.scss +++ b/resources/assets/sass/_bst-modules.scss @@ -25,8 +25,8 @@ @import "~bootstrap/scss/list-group"; @import "~bootstrap/scss/close"; @import "~bootstrap/scss/modal"; -//@import "~bootstrap/scss/tooltip"; -//@import "~bootstrap/scss/popover"; +@import "~bootstrap/scss/tooltip"; +@import "~bootstrap/scss/popover"; //@import "~bootstrap/scss/carousel"; @import "~bootstrap/scss/utilities"; //@import "~bootstrap/scss/print"; diff --git a/resources/assets/sass/_variables.scss b/resources/assets/sass/_variables.scss index 45bc727..927e2c5 100644 --- a/resources/assets/sass/_variables.scss +++ b/resources/assets/sass/_variables.scss @@ -19,3 +19,7 @@ $card-border-radius: 5px; $card-inner-border-radius: 2px; $list-group-hover-bg: rgba($primary, .1); + +$tooltip-max-width: 300px; +$tooltip-bg: darken($primary, 20%); +$tooltip-arrow-color: $tooltip-bg; diff --git a/resources/assets/sass/app.scss b/resources/assets/sass/app.scss index 82008a1..1e6f7bb 100644 --- a/resources/assets/sass/app.scss +++ b/resources/assets/sass/app.scss @@ -7,6 +7,18 @@ @import "variables"; @import "bst-modules"; +html { + overflow-y: scroll; +} + +.tooltip-inner { + text-align: left; +} + +.tooltip-inner { + box-shadow: 0 2px 5px rgba(black, .3); +} + .page-navbar { background: white; border-bottom: 1px solid $primary; diff --git a/resources/views/form/_help.blade.php b/resources/views/form/_help.blade.php new file mode 100644 index 0000000..fc2cb46 --- /dev/null +++ b/resources/views/form/_help.blade.php @@ -0,0 +1,11 @@ +
+ @if($w->help) + help, '<')) + data-html="true" + @endif + title="{{ $w->help }}"> + @endif +
diff --git a/resources/views/form/input.blade.php b/resources/views/form/input.blade.php new file mode 100644 index 0000000..2867fbd --- /dev/null +++ b/resources/views/form/input.blade.php @@ -0,0 +1,21 @@ +@php +/** @var \App\View\Widget $w */ +@endphp + +
+ +
+ attributes !!}> + + @if ($errors->has($w->name)) + + {{ $errors->first($w->name) }} + + @endif +
+ @include('form._help') +
diff --git a/resources/views/form/textarea.blade.php b/resources/views/form/textarea.blade.php new file mode 100644 index 0000000..77d8028 --- /dev/null +++ b/resources/views/form/textarea.blade.php @@ -0,0 +1,20 @@ +@php +/** @var \App\View\Widget $w */ +@endphp + +
+ +
+ + + @if ($errors->has($w->name)) + + {{ $errors->first($w->name) }} + + @endif +
+ @include('form._help') +
diff --git a/resources/views/table/create.blade.php b/resources/views/table/create.blade.php index a3a8783..b4b93fd 100644 --- a/resources/views/table/create.blade.php +++ b/resources/views/table/create.blade.php @@ -2,92 +2,49 @@ @section('content')
-
-
-
- - - - @if ($errors->has('table-name')) - - {{ $errors->first('table-name') }} - - @endif -
- -
- - +
+

New Table

- @if ($errors->has('table-descr')) - - {{ $errors->first('table-descr') }} - - @endif -
- -
- - - - @if ($errors->has('license')) - - {{ $errors->first('license', 'CC0') }} - - @endif -
+ @csrf +
+ {!! Widget::text('table-name', 'Title')->help('Unique among your tables') !!} + + {!! Widget::textarea('table-descr', 'Description')->height('8em') + ->help('Description what data is in the table. Please use the dedicated + fields for License and data source. URLs in a full format will be clickable.') !!} + + {!! Widget::text('license', 'License') + ->help('License applicable to the table\'s data, if any. By default, all + tables are CC0 or Public Domain.') !!} + + {!! Widget::text('upstream', 'Adapted from') + ->help('If you took the data from some external site, a book, etc., write it here. + URLs in a full format will be clickable.') !!} + + {!! Widget::textarea('col-spec', 'Columns')->value($exampleColSpec)->height('8em') + ->help(' +
+ Column parameters in CSV format: +
    +
  • column identifier
    letters, numbers, underscore +
  • column data type
    int, string, float, bool +
  • column title
    used for display (optional) +
+
') !!} + + {!! Widget::textarea('row-data', 'Initial data')->value($exampleData)->height('12em') + ->help(' + Initial table data in CSV format, columns corresponding to the + specification you entered above.') !!}
- - - - @if ($errors->has('upstream')) - - {{ $errors->first('upstream') }} - - @endif -
- -
-
-
-

Insert the initial table definition and data in CSV format. Columns are defined as CSV rows:

-
    -
  • type (int, string, float, bool) -
  • column identifier (letters, numbers, and underscore only) -
  • user-friendly column title -
+
+
- -
- - - - @if ($errors->has('col-spec')) - - {{ $errors->first('col-spec') }} - - @endif -
- -
- - - - @if ($errors->has('row-data')) - - {{ $errors->first('row-data') }} - - @endif -
-
+
@endsection diff --git a/routes/login.php b/routes/login.php index b4b315d..0a69307 100644 --- a/routes/login.php +++ b/routes/login.php @@ -1,4 +1,5 @@ name('home'); + +// Table resource +Route::group([ + 'prefix' => 'table', +], function () { + Route::get('create', 'TableController@create')->name('table.create'); + Route::post('create', 'TableController@storeNew')->name('table.storeNew'); +}); + diff --git a/routes/web.php b/routes/web.php deleted file mode 100644 index 73db1ef..0000000 --- a/routes/web.php +++ /dev/null @@ -1,34 +0,0 @@ -name('home'); - -Route::get('/table/create', 'TableController@create')->name('table.create');