Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,47 @@ class ClientController extends Controller
{
/**
* Display a listing of the resource.
*/
*/
public function index()
{
//
}
// dd("hello");
$clients= Client::all();
return view('admin.client.index',compact('clients'));

}

/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
return view('admin.client.create' ,compact('clients'));
}


/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}
// public function store(Request $request)
// {
// return view('admin.client.store');
// }


/**
* Display the specified resource.
*/
public function show(Client $client)
{
//
return view('admin.client.show',compact('clients'));
}

/**
* Show the form for editing the specified resource.
*/
public function edit(Client $client)
{
//
return view('admin.client.edit',compact('clients'));
}

/**
Expand Down
10 changes: 0 additions & 10 deletions app/Models/Client.php

This file was deleted.

18 changes: 18 additions & 0 deletions app/Models/clients.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Client extends Model
{
//Field Type Description
protected $fillable = [
'name',
'email',
'phone_number',
'address',
'status'
];

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ public function up(): void
{
Schema::create('clients', function (Blueprint $table) {
$table->id();
$table-> string('name')->unique();
$table-> string('email')->unique();
$table-> integer('phone_number')->unique();
$table-> string('address')->nullable();
$table->enum('status',['active','inactive'])->default('active');
$table->timestamps();
});
}
Expand Down
49 changes: 49 additions & 0 deletions resources/views/admin/client/create.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
@extends('admin.layouts.master')

@section('content')
<div class="card shadow mb-4">
<div class="card-header py-3 d-flex" style="justify-content:space-between">
<h6 class="m-0 font-weight-bold text-primary">Add Client</h6>
<a href="{{ route('admin.clients.index') }}" class="btn btn-success"> Back </a>
</div>
<div class="card-body">
<div class="table-responsive">

<form action="{{ route('admin.clients.store') }}" method="POST">
@csrf

<div class="mb-3">
<label for="name" class="form-label">Name</label>
<input type="text" class="form-control" name="name" id="name" required>
</div>

<div class="mb-3">
<label for="emial" class="form-label">email</label>
<input type="email" class="form-control" name="email" id="email">
</div>


<div class="mb-3">
<label for="address" class="form-label">address</label>
<input type="text" class="form-control" name="address" id="address">

</div>
<div class="mb-3">
<label for="phoneno" class="form-label">PhoneNo</label>
<input type="integer" class="form-control" name="phone_no" id="phone_no">

</div>
<div class="mb-3">
<label for="status" class="form-label">Status</label>
<select class="form-select form-control" name="status" id="status" required>
<option value="active">Active</option>
<option value="inactive">Inactive</option>
</select>
</div>
<button type="submit" class="btn btn-primary">Add clients</button>
</form>

</div>
</div>
</div>
@endsection
45 changes: 45 additions & 0 deletions resources/views/admin/client/edit.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
@extends('admin.layouts.master')

@section('content')
<div class="card shadow mb-4">
<div class="card-header py-3 d-flex" style="justify-content:space-between">
<h6 class="m-0 font-weight-bold text-primary">Updatclient</h6>
<a href="{{ route('admin.clients.index') }}" class="btn btn-success"> Back </a>
</div>
<div class="card-body">
<div class="table-responsive">

<form action="{{ route('admin.clients.update', $employee->id) }}" method="POST">
@csrf
@method('PUT')

<div class="mb-3">
<label for="name" class="form-label">Name</label>
<input type="text" class="form-control" name="name" id="name"
value="{{ $client->name }}" required>
</div>

<div class="mb-3">
<label for="email" class="form-label">email</label>
<input type="email" class="form-control" name="email" id="email"
value="{{ $client->email }}">
</div>
<div class="mb-3">
<label for="phone" class="form-label">phone</label>
<input type="tel" class="form-control" name="phone" id="phone"
value="{{ $client->phone }}">
</div>
<div class="mb-3">
<label for="address" class="form-label">address</label>
<input type="text" class="form-control" name="address" id="address"
value="{{ $client->address }}">
</div>


<button type="submit" class="btn btn-primary">Update Client</button>
</form>

</div>
</div>
</div>
@endsection
55 changes: 55 additions & 0 deletions resources/views/admin/client/index.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
@extends('admin.layouts.master')

@section('content')
<div class="card shadow mb-4">
<div class="card-header py-3 d-flex" style="justify-content:space-between">
<h6 class="m-0 font-weight-bold text-primary">Clients Record</h6>
<a href="{{ route('admin.clients.create') }}" class="btn btn-success"> Add Client </a>
</div>
{{-- @dd('hello') --}}
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
<thead>
<tr>
<th>Name</th>
<th>Email</th>
<th>Phone</th>
<th>Address</th>
<th>Action</th>
</tr>
</thead>
<tbody>



@foreach ($client as $data)
{{-- @dd($data) --}}
<tr>
<td>{{ $data->name }}</td>
<td>{{ $data->email }}</td>
<td>{{ $data->phone }}</td>
<td>{{ $data->address }}</td>
<td>{{ $data->designation }}</td>
<td>
{{-- edit --}}
<a href="{{ route('admin.clients.edit', $data->id) }}" class="btn btn-info">
Edit
</a>
{{-- for delete --}}
<form action="{{ route('admin.clients.destroy', $data->id) }}" method="POST">
@csrf
@method('Delete')

<button type="submit" class="btn btn-danger">Delete</button>
</form>

</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
@endsection
4 changes: 4 additions & 0 deletions resources/views/admin/client/show.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@extends('admin.layouts.master')

@section('content')
@endsection
2 changes: 2 additions & 0 deletions routes/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ function () {
Route::resource('comments', CommentController::class)->names('comments');
Route::resource('students', StudentController::class)->names('students');
Route::resource('educations', EducationController::class)->names('educations');
Route::resource('clients', ClientController::class)->names('clients');
}


);