first commit
This commit is contained in:
Executable
+8
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
abstract class Controller
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire;
|
||||
|
||||
use Hive\Services\UserService;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Livewire\Component;
|
||||
|
||||
class AssignTo extends Component
|
||||
{
|
||||
private $queryResults = [];
|
||||
|
||||
public $query = "";
|
||||
|
||||
public $value = "";
|
||||
|
||||
private $selection = [];
|
||||
|
||||
public $display = "none";
|
||||
|
||||
public $simpleResult = "";
|
||||
|
||||
private $service;
|
||||
|
||||
function boot() {
|
||||
$this->service = App::make(UserService::class);
|
||||
}
|
||||
|
||||
function updated()
|
||||
{
|
||||
if (strlen($this->query) > 2) {
|
||||
$this->display = "";
|
||||
$this->queryResults = $this->service->search($this->query);
|
||||
}
|
||||
}
|
||||
|
||||
public function add($id)
|
||||
{
|
||||
if (!str_contains($this->value, $id)) {
|
||||
$this->value .= $id . "|";
|
||||
$this->selection[] = $this->service->getById($id);
|
||||
}
|
||||
}
|
||||
|
||||
public function remove($id)
|
||||
{
|
||||
if (str_contains($this->value, $id)) {
|
||||
$this->value = str_replace($id . "|", "", $this->value);
|
||||
$this->selection = collect($this->selection)->reject(function ($item) use ($id) {
|
||||
return $item->id == $id;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.assign-to', [
|
||||
"queryResults" => $this->queryResults,
|
||||
"simpleResult" => $this->simpleResult,
|
||||
"selection" => $this->selection
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire;
|
||||
|
||||
use Livewire\Component;
|
||||
use Livewire\Attributes\On;
|
||||
|
||||
class Trix extends Component
|
||||
{
|
||||
|
||||
#[On('file-uploaded')]
|
||||
function uploadAttachment($event)
|
||||
{
|
||||
dd($event);
|
||||
dd(json_decode($event));
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.trix');
|
||||
}
|
||||
}
|
||||
Executable
+48
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
/** @use HasFactory<\Database\Factories\UserFactory> */
|
||||
use HasFactory, Notifiable;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'email',
|
||||
'password',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for serialization.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'remember_token',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the attributes that should be cast.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'email_verified_at' => 'datetime',
|
||||
'password' => 'hashed',
|
||||
];
|
||||
}
|
||||
}
|
||||
Executable
+24
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user