Merge branch 'main' of http://bibgit.com/dharmaraj/New-OMIS into omis_dharma
This commit is contained in:
@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Leave\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Modules\Leave\Database\factories\LeaveFactory;
|
||||
|
||||
class Leave extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $fillable = [];
|
||||
|
||||
protected static function newFactory(): LeaveFactory
|
||||
{
|
||||
//return LeaveFactory::new();
|
||||
}
|
||||
}
|
@ -22,6 +22,7 @@ class LeaveController extends Controller
|
||||
public function index()
|
||||
{
|
||||
$data['leaves'] = $this->leaveRepository->findAll();
|
||||
// dd($data['leaves']);
|
||||
return view('leave::index');
|
||||
}
|
||||
|
||||
@ -39,7 +40,14 @@ class LeaveController extends Controller
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
dd($request->all());
|
||||
$inputData = $request->all();
|
||||
try {
|
||||
$this->leaveRepository->create($inputData);
|
||||
toastr()->success('Leave Created Succesfully');
|
||||
} catch (\Throwable $th) {
|
||||
toastr()->error($th->getMessage());
|
||||
}
|
||||
return redirect()->route('leave.index');
|
||||
}
|
||||
|
||||
/**
|
12
Modules/Leave/app/Models/Leave.php
Normal file
12
Modules/Leave/app/Models/Leave.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Leave\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Leave extends Model
|
||||
{
|
||||
protected $table = 'leaves';
|
||||
protected $guarded = [];
|
||||
|
||||
}
|
@ -4,6 +4,9 @@ namespace Modules\Leave\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Modules\Leave\Repositories\LeaveInterface;
|
||||
use Modules\Leave\Repositories\LeaveRepository;
|
||||
|
||||
|
||||
class LeaveServiceProvider extends ServiceProvider
|
||||
{
|
||||
@ -29,6 +32,7 @@ class LeaveServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
$this->app->bind(LeaveInterface::class, LeaveRepository::class);
|
||||
$this->app->register(RouteServiceProvider::class);
|
||||
}
|
||||
|
0
Modules/Leave/app/Repositories/.gitkeep
Normal file
0
Modules/Leave/app/Repositories/.gitkeep
Normal file
@ -8,7 +8,7 @@ class LeaveRepository implements LeaveInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return Leave::all();
|
||||
return Leave::get();
|
||||
}
|
||||
|
||||
public function getLeaveById($leaveId)
|
0
Modules/Leave/database/factories/.gitkeep
Normal file
0
Modules/Leave/database/factories/.gitkeep
Normal file
@ -12,8 +12,10 @@ return new class extends Migration
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('leaves', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->tinyInteger('leave_id')->unsigned()->autoIncrement();
|
||||
$table->integer('employee_id');
|
||||
$table->date('start_date');
|
||||
$table->date('end_date');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
@ -24,7 +24,8 @@
|
||||
<div class="col-lg-8">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<form action="">
|
||||
<form action="{{ route('leave.store') }}" method="post" class="needs-validation" novalidate>
|
||||
@csrf
|
||||
@include('leave::partials.action')
|
||||
</form>
|
||||
</div>
|
||||
@ -37,3 +38,7 @@
|
||||
<!-- container-fluid -->
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
|
||||
@endpush
|
||||
|
@ -1,22 +1,26 @@
|
||||
<div class="mb-3">
|
||||
<label for="employeeName" class="form-label">Employee Name</label>
|
||||
<input type="text" class="form-control" id="employeeName" placeholder="Enter emploree name">
|
||||
<input type="text" class="form-control" id="employeeName" placeholder="Enter emploree name" name="employeeName"
|
||||
required>
|
||||
<div class="invalid-feedback">
|
||||
Please enter Employee Name.
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="employeeUrl" class="form-label">Employee Department URL</label>
|
||||
<input type="url" class="form-control" id="employeeUrl" placeholder="Enter emploree url">
|
||||
<input type="url" class="form-control" id="employeeUrl" placeholder="Enter emploree url" name="employeeUrl">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="StartleaveDate" class="form-label">Start Leave Date</label>
|
||||
<input type="date" class="form-control" id="StartleaveDate">
|
||||
<input type="date" class="form-control" id="StartleaveDate" name="start_date">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="EndleaveDate" class="form-label">End Leave Date</label>
|
||||
<input type="date" class="form-control" id="EndleaveDate">
|
||||
<input type="date" class="form-control" id="EndleaveDate" name="end_date">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="VertimeassageInput" class="form-label">Message</label>
|
||||
<textarea class="form-control" id="VertimeassageInput" rows="3" placeholder="Enter your message"></textarea>
|
||||
<textarea class="form-control" id="VertimeassageInput" rows="3" placeholder="Enter your message" name="remark"></textarea>
|
||||
</div>
|
||||
<div class="text-end">
|
||||
<button type="submit" class="btn btn-primary">Add Leave</button>
|
||||
|
Reference in New Issue
Block a user