Added Auth

This commit is contained in:
chrosey
2017-06-15 12:47:36 +02:00
parent e6c4eb2009
commit 8b98db74a2
20 changed files with 614 additions and 23 deletions
+1 -1
View File
@@ -6,5 +6,5 @@ use Illuminate\Database\Eloquent\Model;
class Benutzer extends User
{
protected $table = "benutzer";
protected $table = "users";
}
+9
View File
@@ -7,4 +7,13 @@ use Illuminate\Database\Eloquent\Model;
class Eintragung extends Model
{
protected $table = "eintragungen";
protected $dates = ['kann_ab', 'kann_bis'];
public function veranstaltung(){
return $this->belongsTo('App\Veranstaltung');
}
public function user(){
return $this->belongsTo('App\User');
}
}
@@ -51,6 +51,7 @@ class RegisterController extends Controller
'name' => 'required|string|max:255',
'email' => 'required|string|email|max:255|unique:users',
'password' => 'required|string|min:6|confirmed',
'anzeigename' => 'required|string|unique:users'
]);
}
@@ -66,6 +67,8 @@ class RegisterController extends Controller
'name' => $data['name'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
'anzeigename' => $data['anzeigename'],
'telefon' => $data['telefon']
]);
}
}
@@ -0,0 +1,85 @@
<?php
namespace App\Http\Controllers;
use App\Eintragung;
use Illuminate\Http\Request;
class EintragController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param \App\Eintragung $eintragung
* @return \Illuminate\Http\Response
*/
public function show(Eintragung $eintragung)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Eintragung $eintragung
* @return \Illuminate\Http\Response
*/
public function edit(Eintragung $eintragung)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Eintragung $eintragung
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Eintragung $eintragung)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param \App\Eintragung $eintragung
* @return \Illuminate\Http\Response
*/
public function destroy(Eintragung $eintragung)
{
//
}
}
+28
View File
@@ -0,0 +1,28 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class HomeController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
/**
* Show the application dashboard.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
return view('home');
}
}
@@ -27,9 +27,10 @@ class VeranstaltungController extends Controller
{
$v = new Veranstaltung();
$v->beginn = \Carbon\Carbon::today();
$v->gaeste = 0;
return view ('veranstaltung.create', ['model' =>
$v]);
return view ('veranstaltung.create',
$v);
}
/**
@@ -65,7 +66,9 @@ class VeranstaltungController extends Controller
*/
public function show(Veranstaltung $veranstaltung)
{
if ($veranstaltung->has('eintragungen')) {
$veranstaltung->eintragungen;
}
return view('veranstaltung.show', $veranstaltung);
}
+59
View File
@@ -0,0 +1,59 @@
<?php
namespace App\Policies;
use App\User;
use App\Eintragung;
use Illuminate\Auth\Access\HandlesAuthorization;
class EintragPolicy
{
use HandlesAuthorization;
/**
* Determine whether the user can view the eintragung.
*
* @param \App\User $user
* @param \App\Eintragung $eintragung
* @return mixed
*/
public function view(User $user, Eintragung $eintragung)
{
//
}
/**
* Determine whether the user can create eintragungs.
*
* @param \App\User $user
* @return mixed
*/
public function create(User $user)
{
//
}
/**
* Determine whether the user can update the eintragung.
*
* @param \App\User $user
* @param \App\Eintragung $eintragung
* @return mixed
*/
public function update(User $user, Eintragung $eintragung)
{
//
}
/**
* Determine whether the user can delete the eintragung.
*
* @param \App\User $user
* @param \App\Eintragung $eintragung
* @return mixed
*/
public function delete(User $user, Eintragung $eintragung)
{
//
}
}
+64
View File
@@ -0,0 +1,64 @@
<?php
namespace App\Policies;
use App\User;
use App\Veranstaltung;
use Illuminate\Auth\Access\HandlesAuthorization;
class VeranstaltungPolicy
{
use HandlesAuthorization;
/**
* Determine whether the user can view the veranstaltung.
*
* @param \App\User $user
* @param \App\Veranstaltung $veranstaltung
* @return mixed
*/
public function view(User $user, Veranstaltung $veranstaltung)
{
}
/**
* Determine whether the user can create veranstaltungs.
*
* @param \App\User $user
* @return mixed
*/
public function create(User $user)
{
//
}
/**
* Determine whether the user can update the veranstaltung.
*
* @param \App\User $user
* @param \App\Veranstaltung $veranstaltung
* @return mixed
*/
public function update(User $user, Veranstaltung $veranstaltung)
{
//
}
/**
* Determine whether the user can delete the veranstaltung.
*
* @param \App\User $user
* @param \App\Veranstaltung $veranstaltung
* @return mixed
*/
public function delete(User $user, Veranstaltung $veranstaltung)
{
//
}
public function eintragen(User $user,Veranstaltung $veranstaltung)
{
}
}
+11 -2
View File
@@ -8,14 +8,13 @@ use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'email', 'password',
'name', 'email', 'password', 'anzeigename', 'telefon'
];
/**
@@ -26,4 +25,14 @@ class User extends Authenticatable
protected $hidden = [
'password', 'remember_token',
];
public function eintragungen(){
return $this->hasMany('App\Eintragung');
}
public function einteilungen(){
return $this->hasMany('App\Einteilung');
}
public function arbeitszeiten(){
return $this->hasMany('App\Arbeitszeit');
}
}
+8
View File
@@ -11,4 +11,12 @@ class Veranstaltung extends Model
protected $fillable = ['name','beginn','ende','geaste','hinweise'];
protected $dates = ['beginn', 'ende'];
public function eintragungen(){
return $this->hasMany('App\Eintragung');
}
public function einteilungen(){
return $this->hasMany('App\Einteilung');
}
}