Skip to content

Commit deff659

Browse files
committed
Initial commit
0 parents  commit deff659

File tree

6,323 files changed

+1000009
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

6,323 files changed

+1000009
-0
lines changed

app/Console/Commands/Inspire.php

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
namespace App\Console\Commands;
4+
5+
use Illuminate\Console\Command;
6+
use Illuminate\Foundation\Inspiring;
7+
8+
class Inspire extends Command
9+
{
10+
/**
11+
* The name and signature of the console command.
12+
*
13+
* @var string
14+
*/
15+
protected $signature = 'inspire';
16+
17+
/**
18+
* The console command description.
19+
*
20+
* @var string
21+
*/
22+
protected $description = 'Display an inspiring quote';
23+
24+
/**
25+
* Execute the console command.
26+
*
27+
* @return mixed
28+
*/
29+
public function handle()
30+
{
31+
$this->comment(PHP_EOL.Inspiring::quote().PHP_EOL);
32+
}
33+
}

app/Console/Commands/Wish.php

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?php
2+
3+
namespace App\Console\Commands;
4+
5+
use App\Models\Employee;
6+
use App\User;
7+
use Carbon\Carbon;
8+
use Illuminate\Console\Command;
9+
use Illuminate\Contracts\Mail\Mailer;
10+
11+
class Wish extends Command
12+
{
13+
/**
14+
* The name and signature of the console command.
15+
*
16+
* @var string
17+
*/
18+
protected $signature = 'send:wishes';
19+
20+
/**
21+
* The console command description.
22+
*
23+
* @var string
24+
*/
25+
protected $description = 'sends an email wishing birthdays/work anniversary';
26+
27+
/**
28+
* Create a new command instance.
29+
*
30+
* @return void
31+
*/
32+
public function __construct(Mailer $mailer)
33+
{
34+
$this->mailer = $mailer;
35+
parent::__construct();
36+
}
37+
38+
/**
39+
* Execute the console command.
40+
*
41+
* @return mixed
42+
*/
43+
public function handle()
44+
{
45+
$dateToday = date('Y-m-d');
46+
$users = \App\Models\Employee::whereRaw("DATE_FORMAT(`dob`, '%m-%d') = DATE_FORMAT('$dateToday', '%m-%d')")->with('user')->get();
47+
$emps = \App\Models\Employee::whereRaw("DATE_FORMAT(`doj`, '%m-%d') = DATE_FORMAT('$dateToday', '%m-%d')")->with('user')->get();
48+
49+
50+
foreach($users as $user)
51+
{
52+
//send an email
53+
$subject = " Happy Birthday $user->emp_name";
54+
$body= "Dear $user->emp_name, <br /> <br /> Digital Ip Insights wishes you a very happy birthday. Have fun and enjoy your day.<br /> <br /><img src='http://shetakesontheworld.com/wp-content/uploads/2012/01/shutterstock_59781901.jpg'> <br /><br /> Regards, <br /><br /> Digital Ip Insights Pvt. Ltd. ";
55+
$this->mailer->send('hrms.wishes.birthday', ['body' => $body], function($message) use($user, $subject)
56+
{
57+
$message->from('[email protected]', 'Digital IP Insights Pvt Ltd');
58+
$message->to($user->user->email, $user->name)->subject($subject);
59+
});
60+
}
61+
62+
foreach($emps as $emp)
63+
{
64+
//send an email
65+
$subject = " Congratulations on Work Anniversary $emp->emp_name";
66+
$body= "Dear $emp->emp_name, <br /> <br /> Many congratulations for your work anniversary. Wish you loads of success for your future.<br /> <br /><img src='http://ak.imgag.com/imgag/product/postcards/3397536/550x400xgraphic1.jpg.pagespeed.ic.G_VtKZOtwJ.jpg'> <br /><br /> Regards, <br /><br /> Digital Ip Insights Pvt. Ltd. ";
67+
$this->mailer->send('hrms.wishes.anniversary', ['body' => $body], function($message) use($emp, $subject)
68+
{
69+
$message->from('[email protected]', 'Digital IP Insights Pvt Ltd');
70+
$message->to($emp->user->email, $emp->name)->subject($subject);
71+
});
72+
}
73+
74+
75+
76+
77+
78+
}
79+
}

app/Console/Kernel.php

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
namespace App\Console;
4+
5+
use Illuminate\Console\Scheduling\Schedule;
6+
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
7+
8+
class Kernel extends ConsoleKernel
9+
{
10+
/**
11+
* The Artisan commands provided by your application.
12+
*
13+
* @var array
14+
*/
15+
protected $commands = [
16+
// Commands\Inspire::class,
17+
\App\Console\Commands\Wish::class
18+
];
19+
20+
/**
21+
* Define the application's command schedule.
22+
*
23+
* @param \Illuminate\Console\Scheduling\Schedule $schedule
24+
* @return void
25+
*/
26+
protected function schedule(Schedule $schedule)
27+
{
28+
// $schedule->command('inspire')
29+
// ->hourly();
30+
}
31+
}

app/EmployeeLeaves.php

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace App;
4+
5+
use Illuminate\Database\Eloquent\Model;
6+
7+
class EmployeeLeaves extends Model
8+
{
9+
public function leaveType()
10+
{
11+
return $this->hasOne('App\Models\LeaveType', 'id', 'leave_type_id');
12+
}
13+
}

app/Events/Event.php

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
namespace App\Events;
4+
5+
abstract class Event
6+
{
7+
//
8+
}

app/Exceptions/Handler.php

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
3+
namespace App\Exceptions;
4+
5+
use Exception;
6+
use Illuminate\Validation\ValidationException;
7+
use Illuminate\Auth\Access\AuthorizationException;
8+
use Illuminate\Database\Eloquent\ModelNotFoundException;
9+
use Symfony\Component\HttpKernel\Exception\HttpException;
10+
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
11+
12+
class Handler extends ExceptionHandler
13+
{
14+
/**
15+
* A list of the exception types that should not be reported.
16+
*
17+
* @var array
18+
*/
19+
protected $dontReport = [
20+
AuthorizationException::class,
21+
HttpException::class,
22+
ModelNotFoundException::class,
23+
ValidationException::class,
24+
];
25+
26+
/**
27+
* Report or log an exception.
28+
*
29+
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
30+
*
31+
* @param \Exception $e
32+
* @return void
33+
*/
34+
public function report(Exception $e)
35+
{
36+
parent::report($e);
37+
}
38+
39+
/**
40+
* Render an exception into an HTTP response.
41+
*
42+
* @param \Illuminate\Http\Request $request
43+
* @param \Exception $e
44+
* @return \Illuminate\Http\Response
45+
*/
46+
public function render($request, Exception $e)
47+
{
48+
return parent::render($request, $e);
49+
}
50+
}
+127
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
<?php
2+
3+
namespace App\Http\Controllers;
4+
5+
use App\Models\Asset;
6+
use App\Models\AssignAsset;
7+
use App\Models\Employee;
8+
use Illuminate\Http\Request;
9+
10+
use App\Http\Requests;
11+
12+
class AssetController extends Controller
13+
{
14+
15+
public function addAsset()
16+
{
17+
return view('hrms.asset.add_asset');
18+
}
19+
20+
Public function processAsset(Request $request)
21+
{
22+
23+
$asset = new Asset;
24+
$asset->name = $request->name;
25+
$asset->description = $request->description;
26+
$asset->save();
27+
\Session::flash('flash_message', 'Asset successfully added!');
28+
return redirect()->back();
29+
30+
}
31+
public function showAsset()
32+
{
33+
$assets = Asset::paginate(5);
34+
return view('hrms.asset.show_asset', compact('assets'));
35+
}
36+
37+
public function showEdit($id)
38+
{
39+
$result = Asset::whereid($id)->first();
40+
return view('hrms.asset.add_asset', compact('result'));
41+
}
42+
43+
public function doEdit(Request $request, $id)
44+
{
45+
$name = $request->name;
46+
$description = $request->description;
47+
48+
$edit = Asset::findOrFail($id);
49+
if (!empty($name)) {
50+
$edit->name = $name;
51+
}
52+
if (!empty($description)) {
53+
$edit->description = $description;
54+
}
55+
$edit->save();
56+
\Session::flash('flash_message', 'Asset successfully updated!');
57+
return redirect('asset-listing');
58+
}
59+
60+
public function doDelete($id)
61+
{
62+
$asset = Asset::find($id);
63+
$asset->delete();
64+
\Session::flash('flash_message', 'Asset successfully Deleted!');
65+
return redirect('asset-listing');
66+
}
67+
public function doAssign()
68+
{
69+
$emps = Employee::get();
70+
$assets = Asset::get();
71+
return view('hrms.asset.assign_asset',compact('emps','assets'));
72+
}
73+
public function processAssign(Request $request)
74+
{
75+
$assignment = new AssignAsset();
76+
$assignment->emp_id = $request->emp_id;
77+
$assignment->asset_id = $request->asset_id;
78+
$assignment->doa = date_format(date_create($request->doa), 'Y-m-d');
79+
$assignment->dor = date_format(date_create($request->dor), 'Y-m-d');
80+
$assignment->save();
81+
82+
\Session::flash('flash_message', 'Asset successfully assigned!');
83+
return redirect()->back();
84+
}
85+
86+
public function showAssignment()
87+
{
88+
$assets = AssignAsset::with(['employee', 'asset'])->paginate(5);
89+
return view('hrms.asset.show_assignment', compact('assets'));
90+
}
91+
92+
public function showEditAssign($id)
93+
94+
{
95+
$assigns = AssignAsset::with(['employee', 'asset'])->where('id', $id)->first();
96+
97+
$emps = Employee::get();
98+
$assets = Asset::get();
99+
return view('hrms.asset.edit_asset_assignment', compact('assigns','emps','assets'));
100+
}
101+
102+
public function doEditAssign($id,Request $request)
103+
104+
{
105+
$assignment= AssignAsset::with(['employee', 'asset'])->where('id', $id)->first();
106+
$assignment->emp_id = $request->emp_id;
107+
$assignment->asset_id = $request->asset_id;
108+
$assignment->doa = date_format(date_create($request->doa), 'Y-m-d');
109+
$assignment->dor = date_format(date_create($request->dor), 'Y-m-d');
110+
$assignment->save();
111+
112+
113+
\Session::flash('flash_message', 'Asset Assignment successfully updated!');
114+
return redirect('assignment-listing');
115+
}
116+
117+
118+
public function doDeleteAssign($id)
119+
{
120+
$assign = AssignAsset::find($id);
121+
$assign->delete();
122+
123+
\Session::flash('flash_message', 'Asset Assignment successfully Deleted!');
124+
return redirect('assignment-listing');
125+
}
126+
127+
}

0 commit comments

Comments
 (0)