diff --git a/skolehjem/app/Http/Controllers/UserController.php b/skolehjem/app/Http/Controllers/UserController.php index 7e3be4d..7d76618 100644 --- a/skolehjem/app/Http/Controllers/UserController.php +++ b/skolehjem/app/Http/Controllers/UserController.php @@ -286,7 +286,7 @@ class UserController extends Controller "\"Update\"". "\"Delete\"". ""; - $users = DB::table('users')->where('name_first', 'LIKE',$request->search.'%') + $users = User::query()->where('name_first', 'LIKE',$request->search.'%') ->orWhere('name_last','LIKE', $request->search.'%') ->orWhere('phone','LIKE', $request->search.'%') ->orWhere('email','LIKE',$request->search. '%')->get(); diff --git a/skolehjem/app/UserEvent.php b/skolehjem/app/UserEvent.php new file mode 100644 index 0000000..3899fd5 --- /dev/null +++ b/skolehjem/app/UserEvent.php @@ -0,0 +1,10 @@ +id(); $table->string("name")->unique(); $table->text("description"); $table->string("slug")->unique(); $table->timestamps(); - }); + });*/ } /** diff --git a/skolehjem/database/migrations/2020_07_28_061420_create_user_events_table.php b/skolehjem/database/migrations/2020_07_28_061420_create_user_events_table.php new file mode 100644 index 0000000..e129f3c --- /dev/null +++ b/skolehjem/database/migrations/2020_07_28_061420_create_user_events_table.php @@ -0,0 +1,37 @@ +id(); + $table->integer("user_id")->unique(); + $table->integer("event_id")->unique(); + + $table->timestamps(); + + $table->foreign("user_id")->references("id")->on("users"); + $table->foreign("event_id")->references("id")->on("events"); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('user_events'); + } +}