Added UserEvent.php

This commit is contained in:
Sebastian Davaris 2020-07-28 08:18:45 +02:00
parent 0d221c8439
commit fb65c1b9fc
4 changed files with 50 additions and 3 deletions

View File

@ -286,7 +286,7 @@ class UserController extends Controller
"<th style=\"width: 1em;\"><img class=\"w-100\" src=\"http://127.0.0.1:8000/images/icons/pencil.svg\" alt=\"Update\"></th>". "<th style=\"width: 1em;\"><img class=\"w-100\" src=\"http://127.0.0.1:8000/images/icons/pencil.svg\" alt=\"Update\"></th>".
"<th style=\"width: 1em;\"><img class=\"w-100\" src=\"http://127.0.0.1:8000/images/icons/trashcan.svg\" alt=\"Delete\"></th>". "<th style=\"width: 1em;\"><img class=\"w-100\" src=\"http://127.0.0.1:8000/images/icons/trashcan.svg\" alt=\"Delete\"></th>".
"</tr>"; "</tr>";
$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('name_last','LIKE', $request->search.'%')
->orWhere('phone','LIKE', $request->search.'%') ->orWhere('phone','LIKE', $request->search.'%')
->orWhere('email','LIKE',$request->search. '%')->get(); ->orWhere('email','LIKE',$request->search. '%')->get();

View File

@ -0,0 +1,10 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class UserEvent extends Model
{
//
}

View File

@ -13,13 +13,13 @@ class CreateResourceCategories extends Migration
*/ */
public function up() public function up()
{ {
Schema::create('resource_categories', function (Blueprint $table) { /*Schema::create('resource_categories', function (Blueprint $table) {
$table->id(); $table->id();
$table->string("name")->unique(); $table->string("name")->unique();
$table->text("description"); $table->text("description");
$table->string("slug")->unique(); $table->string("slug")->unique();
$table->timestamps(); $table->timestamps();
}); });*/
} }
/** /**

View File

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUserEventsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('user_events', function (Blueprint $table) {
$table->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');
}
}