Merge branch 'master' of https://github.com/sebathefox/skolehjem-webapp
This commit is contained in:
commit
4eaf3de6d5
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
//The Model to a certain Controller, should contain a class with Controller name to which it belongs.
|
//The Model to a certain Controller, should contain a class with Controller name to which it belongs.
|
||||||
// Allows needed strings to passed onto the database. if there is none. class should appear empty.
|
// Allows needed strings to passed onto the database. if there is none needed. the class should appear empty.
|
||||||
|
|
||||||
//Reference to where the file belongs.
|
//Reference to where the file belongs.
|
||||||
namespace App;
|
namespace App;
|
||||||
|
@ -12,6 +12,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||||
//Class of which should extend Model Library
|
//Class of which should extend Model Library
|
||||||
class Album extends Model
|
class Album extends Model
|
||||||
{
|
{
|
||||||
|
//protected variable which contains name of database field(s) to be filled.
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'name'
|
'name'
|
||||||
];
|
];
|
||||||
|
|
|
@ -9,6 +9,7 @@ namespace App;
|
||||||
//allows the use of Model library
|
//allows the use of Model library
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
//Class of which should extend Model Library
|
||||||
class CalendarDate extends Model
|
class CalendarDate extends Model
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
|
|
@ -10,6 +10,7 @@ namespace App;
|
||||||
//allows the use of Model library
|
//allows the use of Model library
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
//Class of which should extend Model Library
|
||||||
class CalendarEvent extends Model
|
class CalendarEvent extends Model
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
|
|
@ -10,8 +10,10 @@ namespace App;
|
||||||
//allows the use of Model library
|
//allows the use of Model library
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
//Class of which should extend Model Library
|
||||||
class Contact extends Model
|
class Contact extends Model
|
||||||
{
|
{
|
||||||
|
//protected variable which contains name of database field(s) to be filled.
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'contactname', "title", 'email', 'phone'
|
'contactname', "title", 'email', 'phone'
|
||||||
];
|
];
|
||||||
|
|
|
@ -10,6 +10,7 @@ namespace App;
|
||||||
//allows the use of Model library
|
//allows the use of Model library
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
//Class of which should extend Model Library
|
||||||
class Event extends Model
|
class Event extends Model
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -17,6 +18,7 @@ class Event extends Model
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
|
//protected variable which contains name of database field(s) to be filled.
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
"name", "description", "date"
|
"name", "description", "date"
|
||||||
];
|
];
|
||||||
|
|
|
@ -10,6 +10,7 @@ namespace App;
|
||||||
//allows the use of Model library
|
//allows the use of Model library
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
//Class of which should extend Model Library
|
||||||
class ExternalLink extends Model
|
class ExternalLink extends Model
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -17,6 +18,7 @@ class ExternalLink extends Model
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
|
//protected variable which contains name of database field(s) to be filled.
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'name', "link"
|
'name', "link"
|
||||||
];
|
];
|
||||||
|
|
|
@ -10,6 +10,7 @@ namespace App;
|
||||||
//allows the use of Model library
|
//allows the use of Model library
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
//Class of which should extend Model Library
|
||||||
class Feedbacks extends Model
|
class Feedbacks extends Model
|
||||||
{
|
{
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
|
|
|
@ -7,6 +7,7 @@ use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Response;
|
use Illuminate\Http\Response;
|
||||||
use App\User;
|
use App\User;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Spatie\Permission\Models\Role;
|
use Spatie\Permission\Models\Role;
|
||||||
|
|
||||||
|
@ -151,19 +152,36 @@ class UserController extends Controller
|
||||||
// else if(Auth::user()->hasPermissionTo("user.edit")) {
|
// else if(Auth::user()->hasPermissionTo("user.edit")) {
|
||||||
$user = User::find($id);
|
$user = User::find($id);
|
||||||
|
|
||||||
/** @var User $user */
|
|
||||||
$user->update($data);
|
|
||||||
|
|
||||||
if ($request->roles != null) {
|
if ($request->roles != null) {
|
||||||
|
/** @var User $user */
|
||||||
|
$user->update($data);
|
||||||
$user->roles()->detach();
|
$user->roles()->detach();
|
||||||
$user->forgetCachedPermissions();
|
$user->forgetCachedPermissions();
|
||||||
|
|
||||||
foreach ($request->roles as $role){
|
foreach ($request->roles as $role){
|
||||||
$user->assignRole($role);
|
$user->assignRole($role);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//$user->save();
|
||||||
|
} else {
|
||||||
|
if ($request->input('password') != null) {
|
||||||
|
if ($request->input('password') != $request->input('confirmpassword')) {
|
||||||
|
return Response::detect("users.editpass");
|
||||||
|
} elseif (!Hash::check($request->input('oldpassword'), $user->password)) {
|
||||||
|
return Response::detect("users.editpass");
|
||||||
|
} else {
|
||||||
|
/** @var User $user */
|
||||||
|
$user->update($data);
|
||||||
|
Auth::logout();
|
||||||
|
|
||||||
|
return redirect()->route("users.login");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$user->update($data);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$user->save();
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
$users = User::query()->paginate(20);
|
$users = User::query()->paginate(20);
|
||||||
|
|
|
@ -10,8 +10,10 @@ namespace App;
|
||||||
//allows the use of Model library
|
//allows the use of Model library
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
//Class of which should extend Model Library
|
||||||
class MenuPlan extends Model
|
class MenuPlan extends Model
|
||||||
{
|
{
|
||||||
|
//protected variable which contains name of database field(s) to be filled.
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'week', 'monday', "tuesday", 'wednesday', 'thursday'
|
'week', 'monday', "tuesday", 'wednesday', 'thursday'
|
||||||
];
|
];
|
||||||
|
|
|
@ -9,6 +9,7 @@ namespace App;
|
||||||
//allows the use of Model library
|
//allows the use of Model library
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
//Class of which should extend Model Library
|
||||||
class Resource extends Model
|
class Resource extends Model
|
||||||
{
|
{
|
||||||
public function resourceExtension() {
|
public function resourceExtension() {
|
||||||
|
|
|
@ -9,6 +9,7 @@ namespace App;
|
||||||
//allows the use of Model library
|
//allows the use of Model library
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
//Class of which should extend Model Library
|
||||||
class ResourceCategory extends Model
|
class ResourceCategory extends Model
|
||||||
{
|
{
|
||||||
public function resourceExtensions() {
|
public function resourceExtensions() {
|
||||||
|
|
|
@ -9,6 +9,7 @@ namespace App;
|
||||||
//allows the use of Model library
|
//allows the use of Model library
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
//Class of which should extend Model Library
|
||||||
class ResourceExtension extends Model
|
class ResourceExtension extends Model
|
||||||
{
|
{
|
||||||
public function resources() {
|
public function resources() {
|
||||||
|
|
|
@ -15,6 +15,7 @@ use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\Hash;
|
use Illuminate\Support\Facades\Hash;
|
||||||
use Spatie\Permission\Traits\HasRoles;
|
use Spatie\Permission\Traits\HasRoles;
|
||||||
|
|
||||||
|
//Class of which should extend Model Library
|
||||||
class User extends Authenticatable
|
class User extends Authenticatable
|
||||||
{
|
{
|
||||||
use Notifiable;
|
use Notifiable;
|
||||||
|
@ -25,6 +26,7 @@ class User extends Authenticatable
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
|
//protected variable which contains name of database field(s) to be filled.
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'name_first', "name_last", 'email', 'password', "phone"
|
'name_first', "name_last", 'email', 'password', "phone"
|
||||||
];
|
];
|
||||||
|
|
|
@ -9,8 +9,10 @@ namespace App;
|
||||||
//allows the use of Model library
|
//allows the use of Model library
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
//Class of which should extend Model Library
|
||||||
class WashingMachine extends Model
|
class WashingMachine extends Model
|
||||||
{
|
{
|
||||||
|
//protected variable which contains name of database field(s) to be filled.
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'name'
|
'name'
|
||||||
];
|
];
|
||||||
|
|
|
@ -9,8 +9,10 @@ namespace App;
|
||||||
//allows the use of Model library
|
//allows the use of Model library
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
//Class of which should extend Model Library
|
||||||
class WashingReservation extends Model
|
class WashingReservation extends Model
|
||||||
{
|
{
|
||||||
|
//protected variable which contains name of database field(s) to be filled.
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'time', 'machine'
|
'time', 'machine'
|
||||||
];
|
];
|
||||||
|
|
|
@ -19,13 +19,13 @@ class UserSeeder extends Seeder
|
||||||
// } catch (Exception $e) {
|
// } catch (Exception $e) {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
Log::debug("YEET");
|
|
||||||
|
|
||||||
|
|
||||||
if(User::where("name_first", "admin"))
|
/*if(User::where("name_first", "admin"))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|
||||||
Log::debug("OPRET");
|
Log::debug("OPRET");
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
Reservationer
|
Reservationer
|
||||||
</a>
|
</a>
|
||||||
{{-- MÅ IKKE SLETTES!!!! --}}
|
{{-- MÅ IKKE SLETTES!!!! --}}
|
||||||
{{-- <a href="#">--}}
|
{{-- <a href="# ">--}}
|
||||||
{{-- <img src="{{URL::asset('/images/icons/Galleri.svg')}}" alt="Galleri">--}}
|
{{-- <img src="{{URL::asset('/images/icons/Galleri.svg')}}" alt="Galleri">--}}
|
||||||
{{-- Galleri--}}
|
{{-- Galleri--}}
|
||||||
{{-- </a>--}}
|
{{-- </a>--}}
|
||||||
|
|
Loading…
Reference in New Issue