Skip to content

Commit ddf6416

Browse files
author
Ivan
committed
chams part started
1 parent 821d75f commit ddf6416

30 files changed

+1176
-328
lines changed

app/CHAMS/Asset.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
namespace App;
4+
use Illuminate\Database\Eloquent\Model;
5+
6+
/**
7+
* Created by PhpStorm.
8+
* User: User
9+
* Date: 19/07/2016
10+
* Time: 10:19 AM
11+
*/
12+
class Asset extends Model
13+
{
14+
protected $table = 'chams_assets';
15+
protected $fillable = [
16+
'name',
17+
'asset_number',
18+
'valid_from',
19+
'valid_to',
20+
'returned',
21+
'fulfilled',
22+
'given_out_time',
23+
];
24+
}

app/CHAMS/AssetType.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
namespace App;
3+
use Illuminate\Database\Eloquent\Model;
4+
5+
/**
6+
* Created by PhpStorm.
7+
* User: User
8+
* Date: 19/07/2016
9+
* Time: 10:19 AM
10+
*/
11+
class AssetType extends Model
12+
{
13+
protected $table = 'chams_asset_types';
14+
protected $fillable = [
15+
'name',
16+
'persons_allowed',
17+
'guest_name_required',
18+
'booking_form_type',
19+
'meal_cost',
20+
'meal_recovery',
21+
'non_meal_cost',
22+
'returnable',
23+
'return_days',
24+
'is_private',
25+
'box_office',
26+
'email_confirm',
27+
];
28+
}

app/CHAMS/Booking.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
/**
3+
* Created by PhpStorm.
4+
* User: User
5+
* Date: 19/07/2016
6+
* Time: 4:22 PM
7+
*/
8+
9+
namespace App;
10+
11+
12+
use Illuminate\Database\Eloquent\Model;
13+
14+
class Booking extends Model
15+
{
16+
protected $table = 'chams_bookings';
17+
protected $fillable = [
18+
19+
];
20+
}

app/CHAMS/BusinessUnit.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
namespace App;
3+
use Illuminate\Database\Eloquent\Model;
4+
5+
/**
6+
* Created by PhpStorm.
7+
* User: User
8+
* Date: 19/07/2016
9+
* Time: 10:21 AM
10+
*/
11+
class BusinessUnit extends Model
12+
{
13+
protected $table = 'chams_business_units';
14+
protected $fillable = [
15+
'name',
16+
'description'
17+
];
18+
}

app/CHAMS/Event.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
namespace App;
3+
use Illuminate\Database\Eloquent\Model;
4+
5+
/**
6+
* Created by PhpStorm.
7+
* User: User
8+
* Date: 19/07/2016
9+
* Time: 10:20 AM
10+
*/
11+
class Event extends Model
12+
{
13+
protected $table = 'chams_events';
14+
protected $fillable = [
15+
'name',
16+
'location',
17+
'start_date_time',
18+
'end_date_time',
19+
];
20+
}

app/CHAMS/EventCategory.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
namespace App;
3+
use Illuminate\Database\Eloquent\Model;
4+
5+
/**
6+
* Created by PhpStorm.
7+
* User: User
8+
* Date: 19/07/2016
9+
* Time: 10:21 AM
10+
*/
11+
class EventCategory extends Model
12+
{
13+
protected $table = 'chams_event_categories';
14+
protected $fillable = [
15+
'name'
16+
];
17+
}

app/CHAMS/EventType.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
namespace App;
3+
use Illuminate\Database\Eloquent\Model;
4+
5+
/**
6+
* Created by PhpStorm.
7+
* User: User
8+
* Date: 19/07/2016
9+
* Time: 10:20 AM
10+
*/
11+
class EventType extends Model
12+
{
13+
protected $table = 'chams_event_types';
14+
protected $fillable = [
15+
'name',
16+
];
17+
}

app/CHAMS/GuestBooking.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
/**
3+
* Created by PhpStorm.
4+
* User: User
5+
* Date: 19/07/2016
6+
* Time: 4:22 PM
7+
*/
8+
9+
namespace App;
10+
11+
12+
use Illuminate\Database\Eloquent\Model;
13+
14+
class GuestBooking extends Model
15+
{
16+
protected $table = 'chams_guest_bookings';
17+
protected $fillable = [
18+
19+
];
20+
}

app/CHAMS/UserInfo.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
/**
3+
* Created by PhpStorm.
4+
* User: User
5+
* Date: 19/07/2016
6+
* Time: 1:45 PM
7+
*/
8+
9+
namespace App;
10+
11+
12+
use Illuminate\Database\Eloquent\Model;
13+
14+
class StaffInfo extends Model
15+
{
16+
protected $primaryKey = 'user_id';
17+
protected $table = 'chams_user_info';
18+
protected $fillable = [
19+
'staff_id',
20+
'telephone',
21+
'job_title',
22+
'department',
23+
'staff_cost_centre',
24+
'salesforce_id',
25+
'client_title',
26+
'client_business',
27+
];
28+
}

app/Http/Controllers/CHAMS/RoutingController.php

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22
namespace App\Http\Controllers\CHAMS;
33

4+
use App\User;
45
use Illuminate\Routing\Controller;
56

67
/**
@@ -18,6 +19,34 @@ public function home()
1819

1920
public function users()
2021
{
21-
return view('chams.users');
22+
$users = User::chams();
23+
return view('chams.users')->with(array(
24+
"users" => $users
25+
));
26+
}
27+
28+
public function businessUnits()
29+
{
30+
return view('chams.business_units');
31+
}
32+
33+
public function assets()
34+
{
35+
return view('chams.assets');
36+
}
37+
38+
public function events()
39+
{
40+
return view('chams.events');
41+
}
42+
43+
public function bookings()
44+
{
45+
return view('chams.bookings');
46+
}
47+
48+
public function reports()
49+
{
50+
return view('chams.reports');
2251
}
2352
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?php
2+
/**
3+
* Created by PhpStorm.
4+
* User: User
5+
* Date: 19/07/2016
6+
* Time: 5:00 PM
7+
*/
8+
9+
namespace App\Http\Controllers\CHAMS;
10+
11+
12+
use App\Http\Controllers\Controller;
13+
use App\User;
14+
use Illuminate\Http\JsonResponse;
15+
use Illuminate\Http\Request;
16+
17+
class UserController extends Controller
18+
{
19+
function __construct()
20+
{
21+
22+
}
23+
24+
public function index(Request $request)
25+
{
26+
$users = User::chams();
27+
if ($request->ajax()) {
28+
if ($request->wantsJson()) {
29+
return new JsonResponse($users);
30+
} else {
31+
return $users;
32+
}
33+
} else {
34+
return view('chams.users')->with(array(
35+
"users" => $users
36+
));
37+
}
38+
}
39+
40+
public function create(Request $request)
41+
{
42+
43+
}
44+
45+
public function store(Request $request)
46+
{
47+
48+
}
49+
50+
public function edit(Request $request)
51+
{
52+
53+
}
54+
55+
public function update(Request $request)
56+
{
57+
58+
}
59+
60+
public function destroy(Request $request)
61+
{
62+
63+
}
64+
}

app/Http/routes.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@
6868
], function () {
6969
Route::get('/', ['uses' => 'CHAMS\RoutingController@home']);
7070
Route::get('users', ['middleware' => ['auth', 'role:chams_admin'], 'uses' => 'CHAMS\RoutingController@users']);
71+
Route::get('business_units', ['uses' => 'CHAMS\RoutingController@businessUnits']);
72+
Route::get('assets', ['uses' => 'CHAMS\RoutingController@assets']);
73+
Route::get('events', ['uses' => 'CHAMS\RoutingController@events']);
74+
Route::get('bookings', ['uses' => 'CHAMS\RoutingController@bookings']);
75+
Route::get('reports', ['uses' => 'CHAMS\RoutingController@reports']);
7176
});
7277
/**
7378
* @end CHAMS Routes

app/User.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,11 @@ public function pref()
3535
{
3636
return $this->hasOne('App\UserPref');
3737
}
38+
39+
public static function chams()
40+
{
41+
return User::whereHas("roles", function($query){
42+
$query->where("name", "like", "chams%");
43+
})->get();
44+
}
3845
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
use Illuminate\Database\Schema\Blueprint;
4+
use Illuminate\Database\Migrations\Migration;
5+
6+
class CreateChamsUserInfo extends Migration
7+
{
8+
/**
9+
* Run the migrations.
10+
*
11+
* @return void
12+
*/
13+
public function up()
14+
{
15+
Schema::create('chams_user_info', function (Blueprint $table) {
16+
$table->integer('user_id')->unsigned();
17+
$table->primary('user_id');
18+
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
19+
$table->string('staff_id')->nullable();
20+
$table->string('telephone')->nullable();
21+
$table->string('job_title')->nullable();
22+
$table->string('department')->nullable();
23+
$table->string('staff_cost_centre')->nullable();
24+
$table->string('salesforce_id')->nullable();
25+
$table->string('client_title')->nullable();
26+
$table->string('client_business')->nullable();
27+
$table->timestamps();
28+
});
29+
}
30+
31+
/**
32+
* Reverse the migrations.
33+
*
34+
* @return void
35+
*/
36+
public function down()
37+
{
38+
Schema::drop('chams_user_info');
39+
}
40+
}

0 commit comments

Comments
 (0)