123 lines
3.2 KiB
PHP
123 lines
3.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
use App\Models\Project;
|
|
|
|
class MMCController extends Controller
|
|
{
|
|
/**
|
|
* Display a listing of the resource.
|
|
*
|
|
* @param int $project_id
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function index($project_id)
|
|
{
|
|
$project = Project::find($project_id);
|
|
return view('mmc.show', ['project' => $project]);
|
|
}
|
|
|
|
/**
|
|
* Show the form for creating a new resource.
|
|
*
|
|
* @param int $project_id
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function create($project_id)
|
|
{
|
|
$project = Project::find($project_id);
|
|
return view('mmc.create',['project' => $project]);
|
|
}
|
|
|
|
/**
|
|
* Store a newly created resource in storage.
|
|
*
|
|
* @param int $project_id
|
|
* @param \Illuminate\Http\Request $request
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function store($project_id,Request $request)
|
|
{
|
|
// $request->validate([
|
|
// 'username' => ['required', 'string', 'max:255'],
|
|
// 'name' => ['required', 'string', 'max:255'],
|
|
// 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
|
|
// 'password' => ['required', 'confirmed', Rules\Password::defaults()],
|
|
// ]);
|
|
|
|
// // $user =
|
|
// MMC::create([
|
|
// 'username' => $request->username,
|
|
// 'name' => $request->name,
|
|
// 'email' => $request->email,
|
|
// 'is_admin' => false,
|
|
// ]);
|
|
|
|
// return redirect(route('mmc.index',$project_id));
|
|
}
|
|
|
|
/**
|
|
* Display the specified resource.
|
|
*
|
|
* @param int $project_id
|
|
* @param int $id
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function show($project_id,$id)
|
|
{
|
|
// $user = User::find($id);
|
|
// return view('admin.users.show', ['user' => $user]);
|
|
}
|
|
|
|
/**
|
|
* Show the form for editing the specified resource.
|
|
*
|
|
* @param int $id
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function edit($id)
|
|
{
|
|
// $user = User::find($id);
|
|
// return view('admin.users.edit', ['user' => $user]);
|
|
}
|
|
|
|
/**
|
|
* Update the specified resource in storage.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @param int $id
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function update(Request $request, $id)
|
|
{
|
|
// $request->validate([
|
|
// 'username' => 'required|string|max:255|unique:users,username,' . $id,
|
|
// 'name' => 'required|string|max:255',
|
|
// 'email' => 'required|email|unique:users,email,' . $id,
|
|
// ]);
|
|
|
|
// $user = User::find($id);
|
|
|
|
// $user->username = $request->username;
|
|
// $user->name = $request->name;
|
|
// $user->email = $request->email;
|
|
// $user->save();
|
|
|
|
// return redirect(route('users.index'));
|
|
}
|
|
|
|
/**
|
|
* Remove the specified resource from storage.
|
|
*
|
|
* @param int $id
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function destroy($id)
|
|
{
|
|
// User::findOrFail($id)->delete();
|
|
// return redirect()->route('users.index');
|
|
}
|
|
}
|