Merge branch 'master' of https://github.com/sebathefox/skolehjem-webapp
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
//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.
|
||||
namespace App;
|
||||
@@ -12,6 +12,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
//Class of which should extend Model Library
|
||||
class Album extends Model
|
||||
{
|
||||
//protected variable which contains name of database field(s) to be filled.
|
||||
protected $fillable = [
|
||||
'name'
|
||||
];
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace App;
|
||||
//allows the use of Model library
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
//Class of which should extend Model Library
|
||||
class CalendarDate extends Model
|
||||
{
|
||||
//
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace App;
|
||||
//allows the use of Model library
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
//Class of which should extend Model Library
|
||||
class CalendarEvent extends Model
|
||||
{
|
||||
//
|
||||
|
||||
@@ -10,8 +10,10 @@ namespace App;
|
||||
//allows the use of Model library
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
//Class of which should extend Model Library
|
||||
class Contact extends Model
|
||||
{
|
||||
//protected variable which contains name of database field(s) to be filled.
|
||||
protected $fillable = [
|
||||
'contactname', "title", 'email', 'phone'
|
||||
];
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace App;
|
||||
//allows the use of Model library
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
//Class of which should extend Model Library
|
||||
class Event extends Model
|
||||
{
|
||||
/**
|
||||
@@ -17,6 +18,7 @@ class Event extends Model
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
//protected variable which contains name of database field(s) to be filled.
|
||||
protected $fillable = [
|
||||
"name", "description", "date"
|
||||
];
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace App;
|
||||
//allows the use of Model library
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
//Class of which should extend Model Library
|
||||
class ExternalLink extends Model
|
||||
{
|
||||
/**
|
||||
@@ -17,6 +18,7 @@ class ExternalLink extends Model
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
//protected variable which contains name of database field(s) to be filled.
|
||||
protected $fillable = [
|
||||
'name', "link"
|
||||
];
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace App;
|
||||
//allows the use of Model library
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
//Class of which should extend Model Library
|
||||
class Feedbacks extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
|
||||
@@ -7,6 +7,7 @@ use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use App\User;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Spatie\Permission\Models\Role;
|
||||
|
||||
@@ -151,19 +152,36 @@ class UserController extends Controller
|
||||
// else if(Auth::user()->hasPermissionTo("user.edit")) {
|
||||
$user = User::find($id);
|
||||
|
||||
/** @var User $user */
|
||||
$user->update($data);
|
||||
|
||||
if ($request->roles != null) {
|
||||
/** @var User $user */
|
||||
$user->update($data);
|
||||
$user->roles()->detach();
|
||||
$user->forgetCachedPermissions();
|
||||
|
||||
foreach ($request->roles as $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);
|
||||
|
||||
@@ -10,8 +10,10 @@ namespace App;
|
||||
//allows the use of Model library
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
//Class of which should extend Model Library
|
||||
class MenuPlan extends Model
|
||||
{
|
||||
//protected variable which contains name of database field(s) to be filled.
|
||||
protected $fillable = [
|
||||
'week', 'monday', "tuesday", 'wednesday', 'thursday'
|
||||
];
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace App;
|
||||
//allows the use of Model library
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
//Class of which should extend Model Library
|
||||
class Resource extends Model
|
||||
{
|
||||
public function resourceExtension() {
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace App;
|
||||
//allows the use of Model library
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
//Class of which should extend Model Library
|
||||
class ResourceCategory extends Model
|
||||
{
|
||||
public function resourceExtensions() {
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace App;
|
||||
//allows the use of Model library
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
//Class of which should extend Model Library
|
||||
class ResourceExtension extends Model
|
||||
{
|
||||
public function resources() {
|
||||
|
||||
@@ -15,6 +15,7 @@ use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Spatie\Permission\Traits\HasRoles;
|
||||
|
||||
//Class of which should extend Model Library
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use Notifiable;
|
||||
@@ -25,6 +26,7 @@ class User extends Authenticatable
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
//protected variable which contains name of database field(s) to be filled.
|
||||
protected $fillable = [
|
||||
'name_first', "name_last", 'email', 'password', "phone"
|
||||
];
|
||||
|
||||
@@ -9,8 +9,10 @@ namespace App;
|
||||
//allows the use of Model library
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
//Class of which should extend Model Library
|
||||
class WashingMachine extends Model
|
||||
{
|
||||
//protected variable which contains name of database field(s) to be filled.
|
||||
protected $fillable = [
|
||||
'name'
|
||||
];
|
||||
|
||||
@@ -9,8 +9,10 @@ namespace App;
|
||||
//allows the use of Model library
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
//Class of which should extend Model Library
|
||||
class WashingReservation extends Model
|
||||
{
|
||||
//protected variable which contains name of database field(s) to be filled.
|
||||
protected $fillable = [
|
||||
'time', 'machine'
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user