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

65160352 #52

Open
wants to merge 2 commits 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.

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

namespace App\Http\Controllers;

use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;


class user_C extends Controller
{
function user()
{
$users = User::all();
return view('homepage', compact('users'));
}

function add()
{
return view('addpage');
}

function insert(Request $request)
{ //เพิ่ม
$data = ['name' => $request->name];
DB::table('uesrs')->insert($data);
return redirect('/homepage');
}
function delete($id)
{ //ลบ
DB::table('uesrs')->where('id', $id)->delete();
return redirect('/homepage');
}

function edit($id){
$user = DB::table('uesrs')->where('id',$id)->first();
return view('editpage', compact('user'));
}



function update(Request $request, $id)
{
$data = ['name' => $request->name];
DB::table('uesrs')->where('id', $id)->update($data);
return redirect('/homepage');
}
}
Loading