Gitlab@Informatics

Skip to content
Snippets Groups Projects
Commit e65a6cf5 authored by 64160073's avatar 64160073
Browse files

date and time

parent b0860ea0
No related branches found
No related tags found
1 merge request!12proof tranfer update
Showing
with 60 additions and 10 deletions
......@@ -62,6 +62,7 @@ public function login(Request $request)
//ดึง Class Function จาก Model Member
$auth = new Member();
$user = $auth->login_auth($id_card, $pass); //เรียกใช้ Function จาก Model Member
$request->session()->put('mem_id', $user->id);
$request->session()->put('mem_type', $user->mem_type);
$request->session()->put('mem_id_card', $user->mem_id_card);
// $aa['aaa']= $request->session()->get('mem_type');
......
......@@ -4,8 +4,11 @@
use App\Http\Controllers\Controller;
use App\Models\Member;
use App\Models\Receipt;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Storage;
use App\Models\Address;
......@@ -32,8 +35,35 @@ public function Tranfer(){
}
public function Insert_transfer(Request $request) {
echo 'hello';
print_r($request->all());
$request->validate([
'rec_img' => 'required|image|mimes:jpeg,png,jpg|max:2048',
]);
$rec_img = time() . '.' . $request->rec_img->extension();
$request->rec_img->move(public_path('receipt'), $rec_img);
$receipt = new Receipt();
$receipt->rec_name = $request->session()->get('mem_fname_th') . " " . $request->session()->get('mem_lname_th');
$receipt->rec_amount = $request->input('rec_amount');
$receipt->rec_date = $request->input('rec_date');
$receipt->rec_time = $request->input('rec_time') . ":00";
$receipt->rec_img = $rec_img;
$receipt->mem_id = $request->session()->get('mem_id');
echo $receipt->rec_name;
echo "<br>";
echo $receipt->rec_amount;
echo "<br>";
echo $receipt->rec_date;
echo "<br>";
echo $receipt->rec_time;
echo "<br>";
echo $receipt->rec_img;
echo "<br>";
echo $receipt->mem_id;
$receipt->Insert_receipt();
}
public function Profile(Request $request){
......
......@@ -37,7 +37,7 @@ class Member extends Model
public function login_auth($id_card, $pass){
$user = DB::table('Member')->select('mem_id_card','mem_type', 'mem_fname_th', 'mem_lname_th', 'mem_status') // Query ข้อมูลจาก Database
$user = DB::table('Member')->select('id', 'mem_id_card','mem_type', 'mem_fname_th', 'mem_lname_th', 'mem_status') // Query ข้อมูลจาก Database
->where('mem_id_card', $id_card)->where('password', $pass)->first();
......
......@@ -2,7 +2,9 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
/**
* @property integer $id
......@@ -24,5 +26,21 @@ class Receipt extends Model
/**
* @var array
*/
protected $fillable = ['rec_name', 'rec_amount', 'rec_date_and_time', 'rec_img', 'mem_id'];
protected $fillable = ['rec_name', 'rec_amount', 'rec_date', 'rec_time', 'rec_img', 'mem_id'];
public function Insert_receipt() {
// echo $this->rec_date_and_time;
DB::statement('INSERT INTO Receipt(rec_name, rec_amount, rec_date, rec_time, rec_img, rec_status, mem_id)
VALUES(?,?,?,?,?,?,?)',
[
$this->rec_name,
$this->rec_amount,
$this->rec_date,
$this->rec_time,
$this->rec_img,
0,
$this->mem_id
]);
}
}
......@@ -17,8 +17,9 @@ public function up()
$table->id();
$table->string('rec_name')->nullable();
$table->integer('rec_amount')->nullable();
$table->date('rec_date_and_time')->nullable();
$table->binary('rec_img')->nullable();
$table->date('rec_date')->nullable();
$table->time('rec_time')->nullable();
$table->string('rec_img')->nullable();
$table->integer('rec_status')->nullable();
$table->integer('mem_id')->nullable();
});
......
public/receipt/1681011289.png

293 KiB

public/receipt/1681012075.png

293 KiB

public/receipt/1681012213.png

293 KiB

public/receipt/1681012291.png

293 KiB

public/receipt/1681012327.png

293 KiB

public/receipt/1681012505.png

293 KiB

public/receipt/1681013005.png

293 KiB

public/receipt/1681013112.png

293 KiB

public/receipt/1681013241.png

293 KiB

public/receipt/1681013323.png

293 KiB

public/receipt/1681013379.png

293 KiB

public/receipt/1681013597.png

293 KiB

public/receipt/1681013660.png

293 KiB

......@@ -35,21 +35,21 @@
@csrf
<div class="mb-3">
<label class="form-label" for="date_picker">กรณาระบนที่</label><br>
<input class="form-control" type="date" value="2021-06-18" id="html5-date-input" name="">
<input class="form-control" type="date" value="2021-06-18" id="html5-date-input" name="rec_date">
</div>
<div class="mb-3">
<label class="form-label" for="time">กรณาระบเวลา</label><br>
<input type="text" class="form-control" id="basic-default-company" placeholder="เช่น 13.00" name="">
<input type="time" class="form-control" id="basic-default-company" placeholder="เช่น 13.00" name="rec_time">
</div>
<div class="mb-3">
<label class="form-label" for="deposit">กรณาระบจำนวนเงนที่องการฝาก</label><br>
<div class="input-group input-group-merge">
<input type="text" id="basic-default-email" class="form-control" placeholder="เช่น 1000.00" aria-label="1000.00" aria-describedby="basic-default-email2">
<input type="text" id="basic-default-email" class="form-control" placeholder="เช่น 1000.00" aria-label="1000.00" aria-describedby="basic-default-email2" name="rec_amount">
</div>
<div class="mb-3">
<label for="formFile" class="form-label">กรณาอปโหลดสลปการโอน (รองรบไฟล jpg/png
เทานั้)</label><br>
<input class="form-control" type="file" id="formFile">
<input class="form-control" type="file" id="formFile" name="rec_img">
</div>
<button type="submit" class="btn btn-primary waves-effect waves-light">นยนการเตมเง</button>
</form>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment