27 lines
575 B
PHP
27 lines
575 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
use Illuminate\Http\Response;
|
|
|
|
class ActivityGoodsResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @return array
|
|
*/
|
|
public function toArray($request)
|
|
{
|
|
$award_array = [];
|
|
for($i =1; $i<10; $i++){
|
|
$key = 'award_'.$i;
|
|
if($this->$key == 1){
|
|
$award_array[] = $i;
|
|
}
|
|
}
|
|
return $award_array;
|
|
}
|
|
} |