Adds checkin events

This commit is contained in:
Till Deeke 2018-07-21 14:00:17 +02:00
parent 92a2a5ccbc
commit f0acf47101
5 changed files with 137 additions and 0 deletions

View file

@ -0,0 +1,33 @@
<?php
namespace App\Events;
use App\Models\Accessory;
use App\Models\Actionlog;
use App\Models\User;
use Illuminate\Broadcasting\Channel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
class AccessoryCheckedIn
{
use Dispatchable, SerializesModels;
public $accessory;
public $checkedOutTo;
public $checkedInBy;
public $note;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct(Accessory $accessory, $checkedOutTo, User $checkedInBy, $note)
{
$this->accessory = $accessory;
$this->checkedOutTo = $checkedOutTo;
$this->checkedInBy = $checkedInBy;
$this->note = $note;
}
}

View file

@ -0,0 +1,33 @@
<?php
namespace App\Events;
use App\Models\Actionlog;
use App\Models\Asset;
use App\Models\User;
use Illuminate\Broadcasting\Channel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
class AssetCheckedIn
{
use Dispatchable, SerializesModels;
public $asset;
public $checkedOutTo;
public $checkedInBy;
public $note;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct(Asset $asset, $checkedOutTo, User $checkedInBy, $note)
{
$this->asset = $asset;
$this->checkedOutTo = $checkedOutTo;
$this->checkedInBy = $checkedInBy;
$this->note = $note;
}
}

View file

@ -0,0 +1,35 @@
<?php
namespace App\Events;
use App\Models\Actionlog;
use App\Models\Component;
use App\Models\User;
use Illuminate\Broadcasting\Channel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
class ComponentCheckedIn
{
use Dispatchable, SerializesModels;
public $component;
public $checkedOutTo;
public $checkedInBy;
public $quantity;
public $note;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct(Component $component, $checkedOutTo, User $checkedInBy, $quantity, $note)
{
$this->component = $component;
$this->checkedOutTo = $checkedOutTo;
$this->checkedInBy = $checkedInBy;
$this->quantity = $quantity;
$this->note = $note;
}
}

View file

@ -0,0 +1,33 @@
<?php
namespace App\Events;
use App\Models\Actionlog;
use App\Models\License;
use App\Models\User;
use Illuminate\Broadcasting\Channel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
class LicenseCheckedIn
{
use Dispatchable, SerializesModels;
public $license;
public $checkedOutTo;
public $checkedInBy;
public $note;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct(License $license, $checkedOutTo, User $checkedInBy, $note)
{
$this->license = $license;
$this->checkedOutTo = $checkedOutTo;
$this->checkedInBy = $checkedInBy;
$this->note = $note;
}
}

View file

@ -2,6 +2,7 @@
namespace App\Http\Controllers\Assets;
use App\Events\AssetCheckedIn;
use App\Helpers\Helper;
use App\Http\Controllers\Controller;
use App\Http\Requests\AssetCheckinRequest;
@ -85,6 +86,8 @@ class AssetCheckinController extends Controller
$asset->logCheckin($target, e(request('note')));
event(new AssetCheckedIn($asset, $target, Auth::user(), $request->input('note')));
if ($backto=='user') {
return redirect()->route("users.show", $user->id)->with('success', trans('admin/hardware/message.checkin.success'));
}