Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
laravel_IS
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
odlai
laravel_IS
Commits
254f779d
Commit
254f779d
authored
Oct 09, 2019
by
odlai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
insert human view and controller
parent
9450c470
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
176 additions
and
51 deletions
+176
-51
DockerController.php
app/Http/Controllers/DockerController.php
+9
-3
InsertController.php
app/Http/Controllers/InsertController.php
+35
-15
PageController.php
app/Http/Controllers/PageController.php
+9
-0
People.php
app/People.php
+11
-0
templatemo-style.css
public/css/templatemo-style.css
+1
-1
template.blade.php
resources/views/layouts/template.blade.php
+0
-1
people.blade.php
resources/views/people.blade.php
+96
-0
service.blade.php
resources/views/service.blade.php
+10
-30
web.php
routes/web.php
+5
-1
No files found.
app/Http/Controllers/DockerController.php
View file @
254f779d
...
@@ -11,19 +11,25 @@ use Illuminate\Http\Request;
...
@@ -11,19 +11,25 @@ use Illuminate\Http\Request;
class
DockerController
extends
Controller
class
DockerController
extends
Controller
{
{
//
//
private
$docker_ip
=
"http://192.168.50.222:2375"
;
public
function
init
()
public
function
init
()
{
{
$query
=
Path
::
all
();
$query
=
Path
::
all
();
$main
=
Car
::
all
();
$main
=
Car
::
all
();
$client
=
new
\GuzzleHttp\Client
();
$client
=
new
\GuzzleHttp\Client
();
$res
=
$client
->
get
(
'http://192.168.5.194:2375/containers/json'
);
$res
=
$client
->
get
(
$this
->
docker_ip
.
"/containers/json?all=1"
);
$response
=
json_decode
(
$res
->
getBody
()
->
__toString
(),
true
);
$response
=
json_decode
(
$res
->
getBody
()
->
__toString
(),
true
);
$container_count
=
count
(
$response
);
$container_count
=
count
(
$response
);
$result_content
=
array
();
$result_content
=
array
();
// dd($response[0]['Ports']);
for
(
$i
=
0
;
$i
<
$container_count
;
$i
++
){
for
(
$i
=
0
;
$i
<
$container_count
;
$i
++
){
// $array = Arr::add('Id',$response[$i]['Id']);
// $array = Arr::add('Id',$response[$i]['Id']);
array_push
(
$result_content
,[
'Names'
=>
$response
[
$i
][
'Names'
],
'Id'
=>
substr
(
$response
[
$i
][
'Id'
],
0
,
12
),
'State'
=>
$response
[
$i
][
'State'
],
'Status'
=>
$response
[
$i
][
'Status'
]]);
array_push
(
$result_content
,[
'Names'
=>
$response
[
$i
][
'Names'
],
'Id'
=>
substr
(
$response
[
$i
][
'Id'
],
0
,
12
),
'State'
=>
$response
[
$i
][
'State'
],
'Status'
=>
$response
[
$i
][
'Status'
],
'Created'
=>
$response
[
$i
][
'Created'
]]);
}
}
// dd($result_content);
// dd($result_content);
return
View
(
'index'
,[
'page'
=>
'service'
,
'result'
=>
$query
,
'iresult'
=>
$main
,
'contents'
=>
$result_content
,
'navbar_li'
=>
'layouts.navbar_li'
,
'title'
=>
'tt'
]);
return
View
(
'index'
,[
'page'
=>
'service'
,
'result'
=>
$query
,
'iresult'
=>
$main
,
'contents'
=>
$result_content
,
'navbar_li'
=>
'layouts.navbar_li'
,
'title'
=>
'tt'
]);
...
@@ -33,7 +39,7 @@ class DockerController extends Controller
...
@@ -33,7 +39,7 @@ class DockerController extends Controller
$container_id
=
$request
->
input
(
'id'
);
$container_id
=
$request
->
input
(
'id'
);
$client
=
new
\GuzzleHttp\Client
();
$client
=
new
\GuzzleHttp\Client
();
$res
=
$client
->
POST
(
'http://192.168.5.194:2375/containers/'
.
$container_id
.
'/'
.
$status
);
$res
=
$client
->
POST
(
$this
->
docker_ip
.
"/containers/"
.
$container_id
.
"/"
.
$status
);
// $res = $client->get('http://192.168.5.194:2375/containers/json');
// $res = $client->get('http://192.168.5.194:2375/containers/json');
// $RRR=$res->getBody();
// $RRR=$res->getBody();
// $contents = (string) $res->getBody();
// $contents = (string) $res->getBody();
...
...
app/Http/Controllers/InsertController.php
View file @
254f779d
<?php
<?php
namespace
App\Http\Controllers
;
namespace
App\Http\Controllers
;
use
Illuminate\Http\Request
;
use
Illuminate\Http\Request
;
use
DB
;
use
App\People
;
use
App\User
;
use
App\User
;
use
App\Path
;
use
App\Car
;
use
App\Http\Requests
;
use
App\Http\Requests
;
use
App\Http\Controllers\Controller
;
use
App\Http\Controllers\Controller
;
class
InsertController
extends
Controller
{
class
InsertController
extends
Controller
{
public
function
insert
(
Request
$request
){
public
function
insert
(
Request
$request
){
$email
=
$request
->
input
(
'email'
);
$un
=
$request
->
input
(
'username'
);
$data
=
array
(
$ac
=
$request
->
input
(
'account'
);
'name'
=>
$request
->
input
(
'name'
),
$pw
=
$request
->
input
(
'password'
);
"age"
=>
$request
->
input
(
'age'
),
$lic
=
$request
->
input
(
'license'
);
"sex"
=>
$request
->
input
(
'sex'
),
$data
=
array
(
'email'
=>
$email
,
"username"
=>
$un
,
"account"
=>
$ac
,
"password"
=>
$pw
,
"license"
=>
$lic
);
"work"
=>
$request
->
input
(
'work'
),
"phone"
=>
$request
->
input
(
'phone'
)
);
People
::
insert
(
$data
);
return
redirect
()
->
back
();
}
public
function
delete
(
Request
$request
){
DB
::
table
(
'ivy'
)
->
insert
(
$data
);
People
::
where
(
'id'
,
$request
->
input
(
'delete'
))
->
delete
();
// echo "<script>alert('註冊成功');parent.location.href='/'</script> ";
return
redirect
()
->
back
();
}
public
function
update
(
Request
$request
){
$id
=
$request
->
input
(
'id'
);
$name
=
$request
->
input
(
'name'
);
$age
=
$request
->
input
(
'age'
);
$sex
=
$request
->
input
(
'sex'
);
$work
=
$request
->
input
(
'work'
);
$phone
=
$request
->
input
(
'phone'
);
$data
=
array
(
'id'
=>
$id
,
'name'
=>
$name
,
"age"
=>
$age
,
"sex"
=>
$sex
,
"work"
=>
$work
,
"phone"
=>
$phone
);
People
::
where
(
'id'
,
$request
->
input
(
'id'
),
'name'
,
$request
->
input
(
'name'
),
'age'
,
$request
->
input
(
'age'
)
,
'sex'
,
$_POST
[
'sex'
],
'work'
,
$_POST
[
'work'
],
'phone'
,
$request
->
input
(
'phone'
))
->
update
();
return
redirect
()
->
back
();
return
User
::
create
([
'name'
=>
$un
,
'email'
=>
$email
,
'password'
=>
$pw
,
]);
}
}
}
}
\ No newline at end of file
app/Http/Controllers/PageController.php
View file @
254f779d
...
@@ -3,6 +3,7 @@ namespace App\Http\Controllers;
...
@@ -3,6 +3,7 @@ namespace App\Http\Controllers;
use
DB
;
use
DB
;
use
App\Path
;
use
App\Path
;
use
App\Car
;
use
App\Car
;
use
App\People
;
use
Illuminate\Support\Facades\Auth
;
use
Illuminate\Support\Facades\Auth
;
class
PageController
extends
Controller
class
PageController
extends
Controller
{
{
...
@@ -56,4 +57,12 @@ class PageController extends Controller
...
@@ -56,4 +57,12 @@ class PageController extends Controller
$main
=
Car
::
all
();
$main
=
Car
::
all
();
return
View
(
'index'
,[
'page'
=>
'service'
,
'result'
=>
$query
,
'iresult'
=>
$main
,
'navbar_li'
=>
'layouts.navbar_li'
,
'title'
=>
'tt'
]);
return
View
(
'index'
,[
'page'
=>
'service'
,
'result'
=>
$query
,
'iresult'
=>
$main
,
'navbar_li'
=>
'layouts.navbar_li'
,
'title'
=>
'tt'
]);
}
}
public
function
people
()
{
$query
=
Path
::
all
();
$main
=
Car
::
all
();
$people
=
People
::
all
();
return
View
(
'index'
,[
'page'
=>
'people'
,
'result'
=>
$query
,
'iresult'
=>
$main
,
'people'
=>
$people
,
'navbar_li'
=>
'video_replay.layout.navbar_li'
,
'title'
=>
'tt'
]);
}
}
}
\ No newline at end of file
app/People.php
0 → 100644
View file @
254f779d
<?php
namespace
App
;
use
Illuminate\Database\Eloquent\Model
;
class
People
extends
Model
{
//
protected
$table
=
'people'
;
}
\ No newline at end of file
public/css/templatemo-style.css
View file @
254f779d
...
@@ -360,7 +360,7 @@ input[type="checkbox"]:focus {
...
@@ -360,7 +360,7 @@ input[type="checkbox"]:focus {
box-shadow
:
none
;
box-shadow
:
none
;
}
}
.tm-block-products
{
.tm-block-products
{
min-height
:
7
25
px
;
min-height
:
7
90
px
;
}
}
.tm-block-product-categories
{
.tm-block-product-categories
{
min-height
:
650px
;
min-height
:
650px
;
...
...
resources/views/layouts/template.blade.php
View file @
254f779d
...
@@ -61,7 +61,6 @@
...
@@ -61,7 +61,6 @@
@yield('content')
@yield('content')
</div>
</div>
@include('layouts.footer')
<script
src=
"{{asset('js/play-video.js') }}"
></script>
<script
src=
"{{asset('js/play-video.js') }}"
></script>
@section('script')
@section('script')
...
...
resources/views/people.blade.php
0 → 100644
View file @
254f779d
<form
action=
"/insert"
method=
"POST"
>
<input
type =
"hidden"
name =
"_token"
value =
"
<?php
echo
csrf_token
();
?>
"
>
<div
class=
"thumbnail"
>
<div
class=
"form-group row"
>
<div
class=
"col-lg-2"
>
<input
type=
"text"
class=
"form-control"
id=
"name"
name=
"name"
placeholder=
"請輸入姓名"
required=
""
>
</div>
<div
class=
"col-lg-2"
>
<input
type=
"text"
class=
"form-control"
id=
"age"
name=
"age"
placeholder=
"請輸入年齡"
required=
""
>
</div>
<div
class=
"col-lg-2"
>
<select
class=
"form-control"
id=
"sex"
name=
"sex"
>
<option
>
男
</option>
<option
>
女
</option>
</select>
</div>
<div
class=
"col-lg-2"
>
<select
class=
"form-control"
id=
"work"
name=
"work"
>
<option>
後端
</option>
<option>
前台
</option>
<option>
設計
</option>
<option>
項目
</option>
</select>
</div>
<div
class=
"col-lg-2"
>
<input
id=
phone
name=
phone
type=
"text"
class=
"form-control"
placeholder=
"請輸入手機號碼"
>
</div>
<button
type=
"submit"
class=
"btn btn-primary"
>
新增
</button>
<div
class=
"col"
>
<input
class=
"form-control"
id=
"myInput"
type=
"text"
placeholder=
"Search.."
>
</div>
</div>
</div>
<div
class=
"col-lg-13"
>
<div
class=
"thumbnail"
>
<br>
<table
style=
"text-align:center"
class=
"table table-dark table-striped"
>
<thead>
<tr>
<th>
ID
</th>
<th>
姓名
</th>
<th>
年齡
</th>
<th>
性別
</th>
<th>
職業
</th>
<th>
電話
</th>
<th>
編輯
</th>
</tr>
</thead>
<tbody
id=
"myTable"
>
@foreach ($people as $peoples)
<tr>
<td>
{{$peoples->id}}
</td>
<td>
{{$peoples->name}}
</td>
<td>
{{$peoples->age}}
</td>
<td>
{{$peoples->sex}}
</td>
<td>
{{$peoples->work}}
</td>
<td>
{{$peoples->phone}}
</td>
<td>
<form
action=
"delete"
method=
"POST"
>
<input
type =
"hidden"
name =
"_token"
value =
"
<?php
echo
csrf_token
();
?>
"
>
<button
type=
"submit"
class=
"btn btn-Success"
value=
"{{$peoples->id}}"
name=
'update'
>
修改
</button>
<button
type=
"submit"
class=
"btn btn-Danger"
value=
"{{$peoples->id}}"
name=
'delete'
>
刪除
</button>
</td>
</tr>
</form>
@endforeach
</tbody>
</table>
</div>
</div>
<script>
$
(
document
).
ready
(
function
(){
$
(
"#myInput"
).
on
(
"keyup"
,
function
()
{
var
value
=
$
(
this
).
val
().
toLowerCase
();
$
(
"#myTable tr"
).
filter
(
function
()
{
$
(
this
).
toggle
(
$
(
this
).
text
().
toLowerCase
().
indexOf
(
value
)
>
-
1
)
});
});
});
</script>
resources/views/service.blade.php
View file @
254f779d
<h2>
Filterable Table
</h2>
<h2>
Filterable Table
for Docker API
</h2>
<p>
Type something in the input field to search the table for first names, last names or emails:
</p>
<p>
Type something in the input field to search the table for first names, last names or emails:
</p>
<input
class=
"form-control"
id=
"myInput"
type=
"text"
placeholder=
"Search.."
>
<input
class=
"form-control"
id=
"myInput"
type=
"text"
placeholder=
"Search.."
>
<br>
<br>
...
@@ -7,13 +7,12 @@
...
@@ -7,13 +7,12 @@
<table
class=
"table table-bordered"
style=
"color:#fff"
>
<table
class=
"table table-bordered"
style=
"color:#fff"
>
<thead>
<thead>
<tr>
<tr>
<th>
位置
</th>
<th>
Container
</th>
<th>
來源串流
</th>
<th>
State
</th>
<th>
辨識模組
</th>
<th>
Published Ports
</th>
<th>
目的串流
</th>
<th>
Status
</th>
<th>
辨識範圍
</th>
<th>
Created
</th>
<th>
狀態
</th>
<th>
P.S
</th>
<th>
備註
</th>
</tr>
</tr>
</thead>
</thead>
<tbody
id=
"myTable"
>
<tbody
id=
"myTable"
>
...
@@ -21,12 +20,11 @@
...
@@ -21,12 +20,11 @@
<tr>
<tr>
<form
method=
"post"
action=
"{{route('api')}}"
>
<form
method=
"post"
action=
"{{route('api')}}"
>
<input
type =
"hidden"
name =
"_token"
value =
"
<?php
echo
csrf_token
();
?>
"
>
<input
type =
"hidden"
name =
"_token"
value =
"
<?php
echo
csrf_token
();
?>
"
>
<td>
{{$content['
Id'
]}}
</td>
<td>
{{$content['
Names'][0
]}}
</td>
<td>
{{$content['State']}}
</td>
<td>
{{$content['State']}}
</td>
<td></td>
<td>
{{$content['Status']}}
</td>
<td>
{{$content['Status']}}
</td>
<td>
{{$content['Status']}}
</td>
<td>
{{$content['Created']}}
</td>
<td>
{{$content['Status']}}
</td>
<td>
{{$content['Status']}}
</td>
<td>
<td>
<input
type =
"hidden"
name =
"id"
value =
"{{$content['Id']}}"
>
<input
type =
"hidden"
name =
"id"
value =
"{{$content['Id']}}"
>
<button
type=
"submit"
class=
"btn btn-Success"
name=
"btn"
value=
"start"
>
啟動
</button>
<button
type=
"submit"
class=
"btn btn-Success"
name=
"btn"
value=
"start"
>
啟動
</button>
...
@@ -36,24 +34,6 @@
...
@@ -36,24 +34,6 @@
</form>
</form>
</tr>
</tr>
@endforeach
@endforeach
<tr>
<td>
Mary
</td>
<td>
Moe
</td>
<td>
mary@mail.com
</td>
<td>
Mary
</td>
<td>
Moe
</td>
<td>
啟動
</td>
<td>
<form
method=
"post"
action=
"{{route('api')}}"
>
<input
type =
"hidden"
name =
"_token"
value =
"
<?php
echo
csrf_token
();
?>
"
>
<input
type =
"hidden"
name =
"id"
value =
"57444bfeb22b"
>
<button
type=
"submit"
class=
"btn btn-Success"
name=
"btn"
value=
"start"
>
啟動
</button>
<button
type=
"submit"
class=
"btn btn-Danger"
name=
"btn"
value=
"stop"
>
停止
</button>
<button
type=
"submit"
class=
"btn btn-Primary"
name=
"btn"
value=
"restart"
>
重啟
</button>
</form>
</td>
</tr>
</tbody>
</tbody>
</table>
</table>
<!-- </form> -->
<!-- </form> -->
...
...
routes/web.php
View file @
254f779d
...
@@ -18,6 +18,7 @@ Route::get('car_sys','PageController@car_sys');
...
@@ -18,6 +18,7 @@ Route::get('car_sys','PageController@car_sys');
Route
::
get
(
'video_replay'
,
'PageController@video_replay'
);
Route
::
get
(
'video_replay'
,
'PageController@video_replay'
);
Route
::
get
(
'new'
,
'PageController@new'
);
Route
::
get
(
'new'
,
'PageController@new'
);
Route
::
get
(
'smart_parking'
,
'Parking\IndexController@index'
);
Route
::
get
(
'smart_parking'
,
'Parking\IndexController@index'
);
Route
::
get
(
'people'
,
'PageController@people'
);
// Route::get('HRM','PageController@HRM');
// Route::get('HRM','PageController@HRM');
Route
::
post
(
'reg'
,
'ProcessController@reg'
)
->
name
(
'reg'
);
;
Route
::
post
(
'reg'
,
'ProcessController@reg'
)
->
name
(
'reg'
);
;
Route
::
post
(
'login'
,
'ProcessController@login'
)
->
name
(
'login'
);
Route
::
post
(
'login'
,
'ProcessController@login'
)
->
name
(
'login'
);
...
@@ -85,4 +86,7 @@ Route::group(['prefix'=>'HRM'],function (){
...
@@ -85,4 +86,7 @@ Route::group(['prefix'=>'HRM'],function (){
});
});
Route
::
get
(
'service'
,
'DockerController@init'
);
Route
::
get
(
'service'
,
'DockerController@init'
);
Route
::
post
(
'api'
,
'DockerController@test'
)
->
name
(
'api'
);
Route
::
post
(
'api'
,
'DockerController@test'
)
->
name
(
'api'
);
\ No newline at end of file
Route
::
post
(
'insert'
,
'InsertController@insert'
);
Route
::
post
(
'delete'
,
'InsertController@delete'
)
->
name
(
'delete'
);
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment