Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

65160093 #63

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 0 additions & 64 deletions .env.example

This file was deleted.

61 changes: 61 additions & 0 deletions app/Http/Controllers/UserController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?php

namespace App\Http\Controllers;

use App\Models\User;
use Illuminate\Http\Request;

class UserController extends Controller
{
/**
* Display a listing of the resource.
*/
use App\Models\User; // Import the User model

public function index()
{
$users = User::all();
return view('homepage', compact('users'));
}


/**
* Show the form for creating a new resource.
*/
public function create()
{
return view('addpage');
}

/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{

}

/**
* Show the form for editing the specified resource.
*/
public function edit(Company $company)
{

}

/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id)
{

}

/**
* Remove the specified resource from storage.
*/
public function destroy(Company $company)
{

}
}
2 changes: 1 addition & 1 deletion app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ protected function casts(): array
'password' => 'hashed',
];
}
}
}
2 changes: 1 addition & 1 deletion config/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'laravel'),
'database' => env('DB_DATABASE', 'final_exam'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
Expand Down
32 changes: 32 additions & 0 deletions database/migrations/2024_03_31_135827_create_companies_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('companies', function (Blueprint $table) {
$table->id();
$table->string('title');
$table->string('name');
$table->string('email');
$table->string('password');
$table->string('avatar');
$table->timestamps();
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('companies');
}
};
28 changes: 27 additions & 1 deletion public/assets/css/adminlte.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,22 @@
* Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/

*,
*:before,
*:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}

body {
margin: 0;
padding: 2rem 1.5rem;
font: 1rem/1.5 "PT Sans", Arial, sans-serif;
color: #5a5a5a;
}

:root {
--blue: #007bff;
--indigo: #6610f2;
Expand Down Expand Up @@ -53009,4 +53025,14 @@ a.text-muted:hover {
.dark-mode .border-dark {
border-color: #4b545c !important;
}
/*# sourceMappingURL=adminlte.css.map */

.inputfile {
width: 0.1px;
height: 0.1px;
opacity: 0;
overflow: hidden;
position: absolute;
z-index: -1;
}
/*# sourceMappingURL=adminlte.css.map */

33 changes: 33 additions & 0 deletions public/assets/css/avatar.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* input[type=file] {
width: 100%;
z-index: 50;
height: 38px;
cursor: pointer;
opacity: 0;
border: 1px solid #000;
} */

/* input[type=file] {
width: 350px;
max-width: 100%;
color: #444;
padding: 5px;
background: #fff;
border-radius: 10px;
border: 1px solid #555;
} */

input[type=file]::file-selector-button {
margin-right: 20px;
border: none;
background: #084cdf;
padding: 10px 20px;
border-radius: 10px;
color: #fff;
cursor: pointer;
transition: background .2s ease-in-out;
}

input[type=file]::file-selector-button:hover {
background: #0d45a5;
}
37 changes: 35 additions & 2 deletions resources/views/addpage.blade.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

@extends('layouts.default')

@section('page_name', 'Add Users Data')
Expand All @@ -12,9 +13,41 @@
@csrf
<div class="card-body">
<div class="form-group row">
<label for="input01" class="col-sm-2 col-form-label">Example Input</label>
<label for="input01" class="col-sm-2 col-form-label">Title</label>
<div class="col-sm-10">
<select class="form-control" id="title" name="input01">
<option disabled selected>เลือก</option>
<option>นาย</option>
<option>นางสาว</option>
<option>นาง</option>
</select>
</div>
</div>
<div class="form-group row">
<label for="input02" class="col-sm-2 col-form-label">Name</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="name" name="input02">
</div>
</div>
<div class="form-group row">
<label for="input03" class="col-sm-2 col-form-label">Email</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="email" name="input03">
</div>
</div>
<div class="form-group row">
<label for="input04" class="col-sm-2 col-form-label">Password</label>
<div class="col-sm-10">
<input type="password" class="form-control" id="password" name="input04">
</div>
</div>
<div class="form-group row">
<label for="input05" class="col-sm-2 col-form-label">Avatar</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="input01">
<div class="custom-file">
<input type="file" class="custom-file-input" id="avatar name="input05">
<label class="custom-file-label" for="customFile">Choose file</label>
</div>
</div>
</div>
</div>
Expand Down
46 changes: 33 additions & 13 deletions resources/views/editpage.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,48 @@
@section('page_name', 'Edit Users Data')
@section('content')
<div class="card card-info">
<div class="card-header">
<h3 class="card-title">Edit User Form</h3>
</div>
<!-- /.card-header -->
<!-- form start -->
<form class="form-horizontal" action="{{ url('/') }}" method="post">
@csrf
<div class="card-body">
<div class="form-group row">
<label for="input01" class="col-sm-2 col-form-label">Example Input</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="input01">
<div class="card-body">
<div class="form-group row">
<label for="input01" class="col-sm-2 col-form-label">Title</label>
<div class="col-sm-10">
<select class="form-control" id="title" name="input01">
<option disabled selected>เลือก</option>
<option>นาย</option>
<option>นางสาว</option>
<option>นาง</option>
</select>
</div>
</div>
<div class="form-group row">
<label for="input02" class="col-sm-2 col-form-label">Name</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="name" name="input02">
</div>
</div>
<div class="form-group row">
<label for="input03" class="col-sm-2 col-form-label">Email</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="email" name="input03">
</div>
</div>
<div class="form-group row">
<label for="input05" class="col-sm-2 col-form-label">Avatar</label>
<div class="col-sm-10">
<div class="custom-file">
<input type="file" class="custom-file-input" id="avatar name="input05">
<label class="custom-file-label" for="customFile">Choose file</label>
</div>
</div>
</div>
</div>
<!-- /.card-body -->
<div class="card-footer">
<button type="submit" class="btn btn-info">Submit</button>
<a href="{{ url('/') }}" class="btn btn-default float-right">Cancel</a>
<button type="reset" class="btn btn-default float-right mr-2">Reset</button>
</div>
<!-- /.card-footer -->
</form>
</div>
<!-- /.card -->
@endsection
@endsection
19 changes: 17 additions & 2 deletions resources/views/homepage.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
<thead>
<tr>
<td width="35px">#</td>
<td>Title</td>
<td>name</td>
<td>email</td>
<td>avatar</td>
<td>Title</td>
<td width="150px">Tools</td>
</tr>
</thead>
Expand All @@ -29,6 +29,21 @@
<button class="btn btn-danger">Delete</button>
</td>
</tr>
{{-- @foreach ($users as $user)
<tr>
<td>{{ $user->id }}</td>
<td>{{ $user->title }}</td>
<td>{{ $user->name }}</td>
<td>{{ $user->email }}</td>
<td>
@if ($user->avatar)
<img src="{{ asset($user->avatar) }}" width='50' height='50' class="img img-responsive" alt="">
@else
No Avatar
@endif
</td>
</tr>
@endforeach --}}
</tbody>
</table>
@endsection
@endsection
Loading