54 lines
1.2 KiB
PHP
Executable File
54 lines
1.2 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Services;
|
|
|
|
use Response;
|
|
use Schema;
|
|
use Hash;
|
|
|
|
use Illuminate\Http\Request;
|
|
use App\Libraries\ListHelper;
|
|
|
|
use App\Contracts\PromotionStationsInterface;
|
|
use App\Helpers\HttpStatusCode;
|
|
use App\Libraries\UuidHelper;
|
|
use App\Helpers\CurrentUserHelper;
|
|
use App\PromotionStations;
|
|
|
|
class PromotionStationsService implements PromotionStationsInterface
|
|
{
|
|
|
|
public $promotionService;
|
|
|
|
public $ps_id;
|
|
|
|
public $modules;
|
|
|
|
public $actions;
|
|
|
|
public function getByField($field,$value)
|
|
{
|
|
$this->promotionService = PromotionStations::where($field,$value);
|
|
return $this->promotionService->get();
|
|
}
|
|
|
|
public function store($promotion_id, $station_ids)
|
|
{
|
|
foreach ($station_ids as $key => $id) {
|
|
$this->promotionService = new PromotionStations;
|
|
$this->promotionService->promotion_id = $promotion_id;
|
|
$this->promotionService->station_id = $id;
|
|
|
|
$this->promotionService->save();
|
|
}
|
|
|
|
}
|
|
|
|
public function delete($promotion_id)
|
|
{
|
|
$this->promotionService = PromotionStations::where('promotion_id',$promotion_id);
|
|
$this->promotionService->delete();
|
|
}
|
|
|
|
|
|
} |