Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

done #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
13,534 changes: 13,534 additions & 0 deletions _ide_helper.php

Large diffs are not rendered by default.

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

namespace App;

use Illuminate\Database\Eloquent\Model;

class Course extends Model
{
//
protected $fillable = [
'name'
];

public function lecturers(){
return $this->hasOne('App\Lecture','idCourses');
}
}
9 changes: 9 additions & 0 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace App\Exceptions;

use Exception;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;

class Handler extends ExceptionHandler
Expand Down Expand Up @@ -48,4 +49,12 @@ public function render($request, Exception $exception)
{
return parent::render($request, $exception);
}
protected function unauthenticated($request, AuthenticationException $exception)
{
if ($request->expectsJson()) {
return response()->json(['error' => 'Unauthenticated.'], 401);
}

return redirect()->guest(route('login'));
}
}
18 changes: 18 additions & 0 deletions app/Helper/Helpers.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
namespace App\Helper;
use Carbon\Carbon;
class Helpers{
public static function formatDate($format = 'd m Y',$value=null){
return Carbon::parse($value)->format($format);
}
public static function getFake($value=null,$msg=null,$false=null){
if($value == 1)
$status = $msg;
else
$status = $false;

return $status;
}

}
?>
12 changes: 11 additions & 1 deletion app/Http/Controllers/Auth/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Auth;

class LoginController extends Controller
{
Expand All @@ -25,7 +26,7 @@ class LoginController extends Controller
*
* @var string
*/
protected $redirectTo = '/home';
protected $redirectTo = '/';

/**
* Create a new controller instance.
Expand All @@ -36,4 +37,13 @@ public function __construct()
{
$this->middleware('guest')->except('logout');
}
public function showLoginForm() {
if(Auth::guard('staff')->check())
return redirect()->route('staff');

return view('auth.login');
}
public function username(){
return 'nim';
}
}
2 changes: 1 addition & 1 deletion app/Http/Controllers/Auth/RegisterController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class RegisterController extends Controller
*
* @var string
*/
protected $redirectTo = '/home';
protected $redirectTo = '/';

/**
* Create a new controller instance.
Expand Down
30 changes: 30 additions & 0 deletions app/Http/Controllers/HomeController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Schedule;
use App\Klas;
use App\Lecturer;
use Carbon\Carbon;
use Helper;
use Auth;
use DateTime;

class HomeController extends Controller
{
/**
* Show the application dashboard.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$data = Schedule::where('class_id',Auth::guard('web')->user()->class_id)->orderBy('class_id','asc')
->orderBy('firstDate','desc')->with('classes')->with('lecturers')->get();

return view('home')->with('data',$data);
}

}
114 changes: 114 additions & 0 deletions app/Http/Controllers/Staff/CourseController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<?php

namespace App\Http\Controllers\Staff;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Course;

class CourseController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
$data = Course::orderBy('id','asc')->where('status',1)->get();
return view('staff.course.course')->with('data',$data);
}

/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
$model = new Course();
return view('staff.course.form')->with(compact('model',$model));
}

/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(\App\Http\Requests\Staff\Course\StoreRequest $request)
{
$data = [
'name' => $request->name,
];

$course = Course::create($data);
\Session::flash('success',$request->name.' Course successfully created');
return redirect()->route('course.index');
}

/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}

/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
$model = Course::findOrFail($id);
return view('staff.course.form')->with(compact('model',$model));
}

/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(\App\Http\Requests\Staff\Course\StoreRequest $request, $id)
{
//
$data = [
'name' => $request->name
];

$model = Course::find($id)->update($data);
\Session::flash('success',$request->name.' Course Updateed created');
return redirect()->route('course.index');

}

/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
public function delete($id){
$data = Course::findOrFail($id);
$data->status = 0;

$data->save();

\Session::flash('success','Course '.$data->name.' Successfully Deleted ');
return redirect()->route('course.index');
}
}
104 changes: 104 additions & 0 deletions app/Http/Controllers/Staff/KlasController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
<?php

namespace App\Http\Controllers\Staff;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Klas;

class KlasController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
$data = Klas::orderBy('id','asc')->get();
//dd($data);
return view('staff.class.class')->with('data',$data);
}

/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
$model = new Klas();
return view('staff.class.form')->with(compact('model',$model));
}

/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(\App\Http\Requests\Staff\Klass\StoreRequest $request)
{
//
$data = [
'name' => $request->name,
'maxPerson' => $request->maxPerson
];
Klas::create($data);
\Session::flash('success','Class '.$request->name.' successfully created');
return redirect()->route('class.index');
}

/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}

/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
}

/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
}

/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
public function delete($id){
$data = Klas::findOrFail($id);
$data->delete();
\Session::flash('success','Class '.$data->name.' successfully delete');
return redirect()->route('class.index');
}
}
Loading