Project continue
This commit is contained in:
@@ -14,7 +14,7 @@ class ProjectController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$projects = Project::all();
|
$projects = Project::all()->sortBy('id');
|
||||||
return view('projects.list', ['projects' => $projects]);
|
return view('projects.list', ['projects' => $projects]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,7 +42,8 @@ class ProjectController extends Controller
|
|||||||
'mmc_path' => ['required', 'string', 'max:255'],
|
'mmc_path' => ['required', 'string', 'max:255'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$user = Project::create([
|
// $project =
|
||||||
|
Project::create([
|
||||||
'name' => $request->name,
|
'name' => $request->name,
|
||||||
'description' => $request->description,
|
'description' => $request->description,
|
||||||
'mmc_path' => $request->mmc_path,
|
'mmc_path' => $request->mmc_path,
|
||||||
@@ -59,7 +60,8 @@ class ProjectController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function show($id)
|
public function show($id)
|
||||||
{
|
{
|
||||||
//
|
$project = Project::find($id);
|
||||||
|
return view('projects.show',['project'=>$project]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -70,7 +72,8 @@ class ProjectController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function edit($id)
|
public function edit($id)
|
||||||
{
|
{
|
||||||
//
|
$project = Project::find($id);
|
||||||
|
return view('projects.edit',['project'=>$project]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -82,7 +85,20 @@ class ProjectController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function update(Request $request, $id)
|
public function update(Request $request, $id)
|
||||||
{
|
{
|
||||||
//
|
$request->validate([
|
||||||
|
'name' => 'required|string|max:255|unique:projects,name,'.$id,
|
||||||
|
'description' => 'required|string|max:255',
|
||||||
|
'mmc_path' => 'required|string|max:255',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$project = Project::find($id);
|
||||||
|
|
||||||
|
$project->name = $request->name;
|
||||||
|
$project->description = $request->description;
|
||||||
|
$project->mmc_path = $request->mmc_path;
|
||||||
|
$project->save();
|
||||||
|
|
||||||
|
return redirect(route('projects.index'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -93,6 +109,7 @@ class ProjectController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function destroy($id)
|
public function destroy($id)
|
||||||
{
|
{
|
||||||
//
|
Project::findOrFail($id)->delete();
|
||||||
|
return redirect()->route('projects.index');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,8 @@ class UserController extends Controller
|
|||||||
'password' => ['required', 'confirmed', Rules\Password::defaults()],
|
'password' => ['required', 'confirmed', Rules\Password::defaults()],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$user = User::create([
|
// $user =
|
||||||
|
User::create([
|
||||||
'username' => $request->username,
|
'username' => $request->username,
|
||||||
'name' => $request->name,
|
'name' => $request->name,
|
||||||
'email' => $request->email,
|
'email' => $request->email,
|
||||||
|
|||||||
@@ -697,9 +697,6 @@ select {
|
|||||||
.z-50 {
|
.z-50 {
|
||||||
z-index: 50;
|
z-index: 50;
|
||||||
}
|
}
|
||||||
.m-2 {
|
|
||||||
margin: 0.5rem;
|
|
||||||
}
|
|
||||||
.mx-auto {
|
.mx-auto {
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
@@ -752,9 +749,6 @@ select {
|
|||||||
.mt-6 {
|
.mt-6 {
|
||||||
margin-top: 1.5rem;
|
margin-top: 1.5rem;
|
||||||
}
|
}
|
||||||
.mb-2 {
|
|
||||||
margin-bottom: 0.5rem;
|
|
||||||
}
|
|
||||||
.block {
|
.block {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
@@ -9120,10 +9114,6 @@ readers do not read off random characters that represent icons */
|
|||||||
--tw-text-opacity: 1;
|
--tw-text-opacity: 1;
|
||||||
color: rgb(31 41 55 / var(--tw-text-opacity));
|
color: rgb(31 41 55 / var(--tw-text-opacity));
|
||||||
}
|
}
|
||||||
.hover\:text-red-900:hover {
|
|
||||||
--tw-text-opacity: 1;
|
|
||||||
color: rgb(127 29 29 / var(--tw-text-opacity));
|
|
||||||
}
|
|
||||||
.focus\:z-10:focus {
|
.focus\:z-10:focus {
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,9 +10,6 @@
|
|||||||
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
|
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
|
||||||
<div class="p-6 bg-white border-b border-gray-200">
|
<div class="p-6 bg-white border-b border-gray-200">
|
||||||
<div class="w-96 mx-auto">
|
<div class="w-96 mx-auto">
|
||||||
<!-- <form method="POST" action="{{ route('users.store') }}"> -->
|
|
||||||
<!-- @csrf -->
|
|
||||||
<!-- User name -->
|
|
||||||
<div>
|
<div>
|
||||||
<x-label for="username" :value="__('User name')" />
|
<x-label for="username" :value="__('User name')" />
|
||||||
|
|
||||||
@@ -44,7 +41,6 @@
|
|||||||
<i class="fa fa-cancel pr-2"></i>{{__('Cancel')}}
|
<i class="fa fa-cancel pr-2"></i>{{__('Cancel')}}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!-- </form> -->
|
<!-- </form> -->
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -43,9 +43,14 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex items-center justify-end mt-4">
|
<div class="flex items-center justify-end mt-4">
|
||||||
<x-button class="ml-4">
|
<button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-full">
|
||||||
{{ __('Create project') }}
|
<i class="fa fa-add pr-2"></i>{{ __('Create project') }}
|
||||||
</x-button>
|
</button>
|
||||||
|
<div class="pl-2">
|
||||||
|
<a href="{{ route('projects.index') }}" class="btn bg-gray-500 hover:bg-gray-700 text-white font-bold py-2 px-4 rounded-full">
|
||||||
|
<i class="fa fa-cancel pr-2"></i>{{__('Cancel')}}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,54 +1,57 @@
|
|||||||
<x-app-layout>
|
<x-app-layout>
|
||||||
<x-slot name="header">
|
<x-slot name="header">
|
||||||
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
|
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
|
||||||
{{ __('Edit user') }}
|
{{ __('Edit project') }}
|
||||||
</h2>
|
</h2>
|
||||||
</x-slot>
|
</x-slot>
|
||||||
|
|
||||||
<div class="py-12">
|
<!-- <div class="py-12">
|
||||||
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
|
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
|
||||||
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
|
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
|
||||||
<div class="p-6 bg-white border-b border-gray-200">
|
<div class="p-6 bg-white border-b border-gray-200">
|
||||||
<x-auth-validation-errors class="mb-4" :errors="$errors" />
|
<div class="w-96 mx-auto">
|
||||||
<form method="POST" action="{{ route('users.update', $user->id) }}">
|
@if ($errors->any())
|
||||||
|
<div class="alert alert-danger text-red-500 p-2">
|
||||||
|
<ul class="list-unstyled alert alert-danger">
|
||||||
|
@foreach ($errors->all() as $error)
|
||||||
|
<li>{{ $error }}</li>
|
||||||
|
@endforeach
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
<form method="POST" action="{{ route('projects.update,$project->id') }}">
|
||||||
@csrf
|
@csrf
|
||||||
@method('PUT')
|
@method('PUT')
|
||||||
<!-- User name -->
|
|
||||||
<!-- <input type="hidden" name="id" id="id" value="{{ $user->id}}"> -->
|
|
||||||
<div>
|
<div>
|
||||||
<x-label for="username" :value="__('User name')" />
|
<x-label for="name" :value="__('Title')" />
|
||||||
|
|
||||||
<x-input id="username" class="block mt-1 w-full" type="text" name="username" value="{{ $user->username }}" required autofocus />
|
<x-input id="name" class="block mt-1 w-full" type="text" name="name" value="{{ $project->name }}" required autofocus />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Name -->
|
|
||||||
<div>
|
|
||||||
<x-label for="name" :value="__('Name')" />
|
|
||||||
|
|
||||||
<x-input id="name" class="block mt-1 w-full" type="text" name="name" value="{{ $user->name }}" required />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Email Address -->
|
|
||||||
<div class="mt-4">
|
<div class="mt-4">
|
||||||
<x-label for="email" :value="__('Email')" />
|
<x-label for="description" :value="__('Description')" />
|
||||||
|
|
||||||
<x-input id="email" class="block mt-1 w-full" type="email" name="email" value="{{ $user->email }}" required />
|
<x-input id="description" class="block mt-1 w-full" type="text" name="description" value="{{ $project->description }}" required />
|
||||||
|
</div>
|
||||||
|
<div class="mt-4">
|
||||||
|
<x-label for="mmc_path" :value="__('MMC Path')" />
|
||||||
|
|
||||||
|
<x-input id="mmc_path" class="block mt-1 w-full" type="text" name="mmc_path" value="{{ $project->mmc_path }}" required />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex items-center justify-end mt-4">
|
<div class="flex items-center justify-end mt-4">
|
||||||
<!-- <button type="submit" class="btn">{{ __('Save') }}</button> -->
|
<button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-full">
|
||||||
<x-button class="ml-4">
|
<i class="fa fa-add pr-2"></i>{{ __('Save') }}
|
||||||
{{ __('Save') }}
|
</button>
|
||||||
</x-button>
|
<div class="pl-2">
|
||||||
<!-- <a href="{{ route('users.index') }}">
|
<a href="{{ route('projects.index') }}" class="btn bg-gray-500 hover:bg-gray-700 text-white font-bold py-2 px-4 rounded-full">
|
||||||
<x-button class="ml-4">
|
<i class="fa fa-cancel pr-2"></i>{{__('Cancel')}}
|
||||||
{{ __('Cancel') }}
|
</a>
|
||||||
</x-button>
|
</div>
|
||||||
</a> -->
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div> -->
|
||||||
</x-app-layout>
|
</x-app-layout>
|
||||||
@@ -9,12 +9,13 @@
|
|||||||
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
|
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
|
||||||
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
|
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
|
||||||
<div class="p-6 bg-white border-b border-gray-200">
|
<div class="p-6 bg-white border-b border-gray-200">
|
||||||
|
|
||||||
<a href="{{ route('projects.create')}}">
|
<a href="{{ route('projects.create')}}">
|
||||||
<x-button class="m-2">{{__('Create project')}}</x-button>
|
<button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-full">
|
||||||
|
<i class="fa fa-add pr-2"></i>{{__('Create project')}}
|
||||||
|
</button>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<div align="center">
|
<div align="center" class="pt-4">
|
||||||
<table class="table table-sm border-b border-gray-200">
|
<table class="table table-sm border-b border-gray-200">
|
||||||
<tr class="border border-gray-200">
|
<tr class="border border-gray-200">
|
||||||
<th class="p-2 border border-gray-200">
|
<th class="p-2 border border-gray-200">
|
||||||
@@ -38,14 +39,18 @@
|
|||||||
<td class="p-2 border border-gray-200">
|
<td class="p-2 border border-gray-200">
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<a href="{{ route('projects.show',$project->id) }}">
|
<a href="{{ route('projects.show',$project->id) }}">
|
||||||
<i class="fa fa-eye text-green-500 px-2 text-lg"></i>
|
<i class="fa fa-eye text-green-500 hover:text-green-700 px-2 text-lg"></i>
|
||||||
</a>
|
</a>
|
||||||
<a href="{{ route('projects.edit',$project->id) }}">
|
<a href="{{ route('projects.edit',$project->id) }}">
|
||||||
<i class="fa fa-edit text-blue-500 px-2 text-lg"></i>
|
<i class="fa fa-edit text-blue-500 hover:text-blue-700 px-2 text-lg"></i>
|
||||||
</a>
|
|
||||||
<a href="{{ route('projects.destroy',$project->id) }}">
|
|
||||||
<i class="fa fa-trash text-red-500 px-2 text-lg"></i>
|
|
||||||
</a>
|
</a>
|
||||||
|
<form class="inline-block" action="{{ route('projects.destroy', $project->id) }}" method="POST" onsubmit="return confirm('{{ __('Are you sure remove project ').$project->name.'?' }}');">
|
||||||
|
<input type="hidden" name="_method" value="DELETE">
|
||||||
|
<input type="hidden" name="_token" value="{{ csrf_token() }}">
|
||||||
|
<button type="submit">
|
||||||
|
<i class="fa fa-trash text-red-500 hover:text-red-700 px-2 text-lg"></i>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<x-app-layout>
|
<x-app-layout>
|
||||||
<x-slot name="header">
|
<x-slot name="header">
|
||||||
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
|
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
|
||||||
{{ __('Show user') }}
|
{{ __('Show project') }}
|
||||||
</h2>
|
</h2>
|
||||||
</x-slot>
|
</x-slot>
|
||||||
|
|
||||||
@@ -9,43 +9,41 @@
|
|||||||
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
|
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
|
||||||
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
|
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
|
||||||
<div class="p-6 bg-white border-b border-gray-200">
|
<div class="p-6 bg-white border-b border-gray-200">
|
||||||
|
<div class="w-96 mx-auto">
|
||||||
<!-- <form method="POST" action="{{ route('users.store') }}"> -->
|
|
||||||
<!-- @csrf -->
|
|
||||||
<!-- User name -->
|
|
||||||
<div>
|
<div>
|
||||||
<x-label for="username" :value="__('User name')" />
|
<x-label for="name" :value="__('Title')" />
|
||||||
|
|
||||||
<x-input id="username" class="block mt-1 w-full" type="text" name="username" value="{{ $user->username }}" readonly />
|
<x-input id="name" class="block mt-1 w-full" type="text" name="name" value="{{ $project->name }}" readonly />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Name -->
|
<!-- Description -->
|
||||||
<div>
|
|
||||||
<x-label for="name" :value="__('Name')" />
|
|
||||||
|
|
||||||
<x-input id="name" class="block mt-1 w-full" type="text" name="name" value="{{ $user->name }}" readonly />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Email Address -->
|
|
||||||
<div class="mt-4">
|
<div class="mt-4">
|
||||||
<x-label for="email" :value="__('Email')" />
|
<x-label for="description" :value="__('Description')" />
|
||||||
|
|
||||||
<x-input id="email" class="block mt-1 w-full" type="email" name="email" value="{{ $user->email }}" readonly />
|
<x-input id="description" class="block mt-1 w-full" type="text" name="description" value="{{ $project->description }}" readonly />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- MMC Path -->
|
||||||
|
<div class="mt-4">
|
||||||
|
<x-label for="mmc_path" :value="__('MMC Path')" />
|
||||||
|
|
||||||
|
<x-input id="mmc_path" class="block mt-1 w-full" type="text" name="mmc_path" value="{{ $project->mmc_path }}" readonly />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex items-center justify-end mt-4">
|
<div class="flex items-center justify-end mt-4">
|
||||||
<a href="{{ route('users.edit',$user->id) }}">
|
<div class="pl-2">
|
||||||
<x-button class="ml-4">
|
<a href="{{ route('projects.edit',$project->id) }}" class="btn bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-full">
|
||||||
{{ __('Edit user') }}
|
<i class="fa fa-edit pr-2"></i>{{__('Edit project')}}
|
||||||
</x-button>
|
|
||||||
</a>
|
|
||||||
<a href="{{ route('users.index') }}">
|
|
||||||
<x-button class="ml-4">
|
|
||||||
{{ __('Cancel') }}
|
|
||||||
</x-button>
|
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<!-- </form> -->
|
<div class="pl-2">
|
||||||
|
<a href="{{ route('projects.index') }}" class="btn bg-gray-500 hover:bg-gray-700 text-white font-bold py-2 px-4 rounded-full">
|
||||||
|
<i class="fa fa-cancel pr-2"></i>{{__('Cancel')}}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user