mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 05:17:31 -05:00 
			
		
		
		
	* minor fix for payment notifications * styleci * Limit Self updating to self hosters only : * Fixes for designs * Minor fixes for self-update
		
			
				
	
	
		
			490 lines
		
	
	
		
			18 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			490 lines
		
	
	
		
			18 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
/**
 | 
						|
 * Invoice Ninja (https://invoiceninja.com)
 | 
						|
 *
 | 
						|
 * @link https://github.com/invoiceninja/invoiceninja source repository
 | 
						|
 *
 | 
						|
 * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
 | 
						|
 *
 | 
						|
 * @license https://opensource.org/licenses/AAL
 | 
						|
 */
 | 
						|
 | 
						|
namespace App\Http\Controllers;
 | 
						|
 | 
						|
use App\Factory\DesignFactory;
 | 
						|
use App\Filters\DesignFilters;
 | 
						|
use App\Http\Requests\Design\CreateDesignRequest;
 | 
						|
use App\Http\Requests\Design\DestroyDesignRequest;
 | 
						|
use App\Http\Requests\Design\EditDesignRequest;
 | 
						|
use App\Http\Requests\Design\ShowDesignRequest;
 | 
						|
use App\Http\Requests\Design\StoreDesignRequest;
 | 
						|
use App\Http\Requests\Design\UpdateDesignRequest;
 | 
						|
use App\Jobs\Entity\ActionEntity;
 | 
						|
use App\Models\Design;
 | 
						|
use App\Transformers\DesignTransformer;
 | 
						|
use App\Utils\Traits\BulkOptions;
 | 
						|
use App\Utils\Traits\MakesHash;
 | 
						|
use Illuminate\Http\Request;
 | 
						|
use Illuminate\Support\Facades\Cache;
 | 
						|
 | 
						|
/**
 | 
						|
 * Class DesignController
 | 
						|
 * @package App\Http\Controllers
 | 
						|
 * @covers App\Http\Controllers\DesignController
 | 
						|
 */
 | 
						|
class DesignController extends BaseController
 | 
						|
{
 | 
						|
    use MakesHash;
 | 
						|
 | 
						|
    protected $entity_type = Design::class;
 | 
						|
 | 
						|
    protected $entity_transformer = DesignTransformer::class;
 | 
						|
 | 
						|
 | 
						|
    /**
 | 
						|
     * DesignController constructor.
 | 
						|
     * @param DesignRepository $designRepo
 | 
						|
     */
 | 
						|
    public function __construct()
 | 
						|
    {
 | 
						|
        parent::__construct();
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     *      @OA\Get(
 | 
						|
     *      path="/api/v1/designs",
 | 
						|
     *      operationId="getDesigns",
 | 
						|
     *      tags={"designs"},
 | 
						|
     *      summary="Gets a list of designs",
 | 
						|
     *      description="Lists designs",
 | 
						|
     *      @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
 | 
						|
     *      @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
 | 
						|
     *      @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
 | 
						|
     *      @OA\Parameter(ref="#/components/parameters/include"),
 | 
						|
     *      @OA\Parameter(ref="#/components/parameters/index"),
 | 
						|
     *      @OA\Response(
 | 
						|
     *          response=200,
 | 
						|
     *          description="A list of designs",
 | 
						|
     *          @OA\Header(header="X-API-Version", ref="#/components/headers/X-API-Version"),
 | 
						|
     *          @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"),
 | 
						|
     *          @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"),
 | 
						|
     *          @OA\JsonContent(ref="#/components/schemas/Design"),
 | 
						|
     *       ),
 | 
						|
     *       @OA\Response(
 | 
						|
     *          response=422,
 | 
						|
     *          description="Validation error",
 | 
						|
     *          @OA\JsonContent(ref="#/components/schemas/ValidationError"),
 | 
						|
 | 
						|
     *       ),
 | 
						|
     *       @OA\Response(
 | 
						|
     *           response="default",
 | 
						|
     *           description="Unexpected Error",
 | 
						|
     *           @OA\JsonContent(ref="#/components/schemas/Error"),
 | 
						|
     *       ),
 | 
						|
     *     )
 | 
						|
     *
 | 
						|
     */
 | 
						|
    public function index(DesignFilters $filters)
 | 
						|
    {
 | 
						|
        $designs = Design::filter($filters);
 | 
						|
 | 
						|
        return $this->listResponse($designs);
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * Display the specified resource.
 | 
						|
     *
 | 
						|
     * @param  int  $id
 | 
						|
     * @return \Illuminate\Http\Response
 | 
						|
     *
 | 
						|
     *
 | 
						|
     * @OA\Get(
 | 
						|
     *      path="/api/v1/designs/{id}",
 | 
						|
     *      operationId="showDesign",
 | 
						|
     *      tags={"designs"},
 | 
						|
     *      summary="Shows a design",
 | 
						|
     *      description="Displays a design by id",
 | 
						|
     *      @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
 | 
						|
     *      @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
 | 
						|
     *      @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
 | 
						|
     *      @OA\Parameter(ref="#/components/parameters/include"),
 | 
						|
     *      @OA\Parameter(
 | 
						|
     *          name="id",
 | 
						|
     *          in="path",
 | 
						|
     *          description="The Design Hashed ID",
 | 
						|
     *          example="D2J234DFA",
 | 
						|
     *          required=true,
 | 
						|
     *          @OA\Schema(
 | 
						|
     *              type="string",
 | 
						|
     *              format="string",
 | 
						|
     *          ),
 | 
						|
     *      ),
 | 
						|
     *      @OA\Response(
 | 
						|
     *          response=200,
 | 
						|
     *          description="Returns the expense object",
 | 
						|
     *          @OA\Header(header="X-API-Version", ref="#/components/headers/X-API-Version"),
 | 
						|
     *          @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"),
 | 
						|
     *          @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"),
 | 
						|
     *          @OA\JsonContent(ref="#/components/schemas/Design"),
 | 
						|
     *       ),
 | 
						|
     *       @OA\Response(
 | 
						|
     *          response=422,
 | 
						|
     *          description="Validation error",
 | 
						|
     *          @OA\JsonContent(ref="#/components/schemas/ValidationError"),
 | 
						|
     *
 | 
						|
     *       ),
 | 
						|
     *       @OA\Response(
 | 
						|
     *           response="default",
 | 
						|
     *           description="Unexpected Error",
 | 
						|
     *           @OA\JsonContent(ref="#/components/schemas/Error"),
 | 
						|
     *       ),
 | 
						|
     *     )
 | 
						|
     *
 | 
						|
     */
 | 
						|
    public function show(ShowDesignRequest $request, Design $design)
 | 
						|
    {
 | 
						|
        return $this->itemResponse($design);
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * Show the form for editing the specified resource.
 | 
						|
     *
 | 
						|
     * @param  int  $id
 | 
						|
     * @return \Illuminate\Http\Response
 | 
						|
     *
 | 
						|
     *
 | 
						|
     * @OA\Get(
 | 
						|
     *      path="/api/v1/designs/{id}/edit",
 | 
						|
     *      operationId="editDesign",
 | 
						|
     *      tags={"designs"},
 | 
						|
     *      summary="Shows a design for editting",
 | 
						|
     *      description="Displays a design by id",
 | 
						|
     *      @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
 | 
						|
     *      @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
 | 
						|
     *      @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
 | 
						|
     *      @OA\Parameter(ref="#/components/parameters/include"),
 | 
						|
     *      @OA\Parameter(
 | 
						|
     *          name="id",
 | 
						|
     *          in="path",
 | 
						|
     *          description="The Design Hashed ID",
 | 
						|
     *          example="D2J234DFA",
 | 
						|
     *          required=true,
 | 
						|
     *          @OA\Schema(
 | 
						|
     *              type="string",
 | 
						|
     *              format="string",
 | 
						|
     *          ),
 | 
						|
     *      ),
 | 
						|
     *      @OA\Response(
 | 
						|
     *          response=200,
 | 
						|
     *          description="Returns the design object",
 | 
						|
     *          @OA\Header(header="X-API-Version", ref="#/components/headers/X-API-Version"),
 | 
						|
     *          @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"),
 | 
						|
     *          @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"),
 | 
						|
     *          @OA\JsonContent(ref="#/components/schemas/Design"),
 | 
						|
     *       ),
 | 
						|
     *       @OA\Response(
 | 
						|
     *          response=422,
 | 
						|
     *          description="Validation error",
 | 
						|
     *          @OA\JsonContent(ref="#/components/schemas/ValidationError"),
 | 
						|
     *
 | 
						|
     *       ),
 | 
						|
     *       @OA\Response(
 | 
						|
     *           response="default",
 | 
						|
     *           description="Unexpected Error",
 | 
						|
     *           @OA\JsonContent(ref="#/components/schemas/Error"),
 | 
						|
     *       ),
 | 
						|
     *     )
 | 
						|
     *
 | 
						|
     */
 | 
						|
    public function edit(EditDesignRequest $request, Design $design)
 | 
						|
    {
 | 
						|
        return $this->itemResponse($design);
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * Update the specified resource in storage.
 | 
						|
     *
 | 
						|
     * @param  \Illuminate\Http\Request  $request
 | 
						|
     * @param  App\Models\Design $design
 | 
						|
     * @return \Illuminate\Http\Response
 | 
						|
     *
 | 
						|
     *
 | 
						|
     *
 | 
						|
     * @OA\Put(
 | 
						|
     *      path="/api/v1/designs/{id}",
 | 
						|
     *      operationId="updateDesign",
 | 
						|
     *      tags={"designs"},
 | 
						|
     *      summary="Updates a design",
 | 
						|
     *      description="Handles the updating of a design by id",
 | 
						|
     *      @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
 | 
						|
     *      @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
 | 
						|
     *      @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
 | 
						|
     *      @OA\Parameter(ref="#/components/parameters/include"),
 | 
						|
     *      @OA\Parameter(
 | 
						|
     *          name="id",
 | 
						|
     *          in="path",
 | 
						|
     *          description="The Design Hashed ID",
 | 
						|
     *          example="D2J234DFA",
 | 
						|
     *          required=true,
 | 
						|
     *          @OA\Schema(
 | 
						|
     *              type="string",
 | 
						|
     *              format="string",
 | 
						|
     *          ),
 | 
						|
     *      ),
 | 
						|
     *      @OA\Response(
 | 
						|
     *          response=200,
 | 
						|
     *          description="Returns the design object",
 | 
						|
     *          @OA\Header(header="X-API-Version", ref="#/components/headers/X-API-Version"),
 | 
						|
     *          @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"),
 | 
						|
     *          @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"),
 | 
						|
     *          @OA\JsonContent(ref="#/components/schemas/Design"),
 | 
						|
     *       ),
 | 
						|
     *       @OA\Response(
 | 
						|
     *          response=422,
 | 
						|
     *          description="Validation error",
 | 
						|
     *          @OA\JsonContent(ref="#/components/schemas/ValidationError"),
 | 
						|
     *
 | 
						|
     *       ),
 | 
						|
     *       @OA\Response(
 | 
						|
     *           response="default",
 | 
						|
     *           description="Unexpected Error",
 | 
						|
     *           @OA\JsonContent(ref="#/components/schemas/Error"),
 | 
						|
     *       ),
 | 
						|
     *     )
 | 
						|
     *
 | 
						|
     */
 | 
						|
    public function update(UpdateDesignRequest $request, Design $design)
 | 
						|
    {
 | 
						|
        if ($request->entityIsDeleted($design)) {
 | 
						|
            return $request->disallowUpdate();
 | 
						|
        }
 | 
						|
 | 
						|
        $design->fill($request->all());
 | 
						|
        $design->save();
 | 
						|
 | 
						|
        return $this->itemResponse($design->fresh());
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * Show the form for creating a new resource.
 | 
						|
     *
 | 
						|
     * @return \Illuminate\Http\Response
 | 
						|
     *
 | 
						|
     *
 | 
						|
     *
 | 
						|
     * @OA\Get(
 | 
						|
     *      path="/api/v1/designs/create",
 | 
						|
     *      operationId="getDesignsCreate",
 | 
						|
     *      tags={"designs"},
 | 
						|
     *      summary="Gets a new blank design object",
 | 
						|
     *      description="Returns a blank object with default values",
 | 
						|
     *      @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
 | 
						|
     *      @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
 | 
						|
     *      @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
 | 
						|
     *      @OA\Parameter(ref="#/components/parameters/include"),
 | 
						|
     *      @OA\Response(
 | 
						|
     *          response=200,
 | 
						|
     *          description="A blank design object",
 | 
						|
     *          @OA\Header(header="X-API-Version", ref="#/components/headers/X-API-Version"),
 | 
						|
     *          @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"),
 | 
						|
     *          @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"),
 | 
						|
     *          @OA\JsonContent(ref="#/components/schemas/Design"),
 | 
						|
     *       ),
 | 
						|
     *       @OA\Response(
 | 
						|
     *          response=422,
 | 
						|
     *          description="Validation error",
 | 
						|
     *          @OA\JsonContent(ref="#/components/schemas/ValidationError"),
 | 
						|
     *
 | 
						|
     *       ),
 | 
						|
     *       @OA\Response(
 | 
						|
     *           response="default",
 | 
						|
     *           description="Unexpected Error",
 | 
						|
     *           @OA\JsonContent(ref="#/components/schemas/Error"),
 | 
						|
     *       ),
 | 
						|
     *     )
 | 
						|
     *
 | 
						|
     */
 | 
						|
    public function create(CreateDesignRequest $request)
 | 
						|
    {
 | 
						|
        $design = DesignFactory::create(auth()->user()->company()->id, auth()->user()->id);
 | 
						|
 | 
						|
        return $this->itemResponse($design);
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * Store a newly created resource in storage.
 | 
						|
     *
 | 
						|
     * @param  \Illuminate\Http\Request  $request
 | 
						|
     * @return \Illuminate\Http\Response
 | 
						|
     *
 | 
						|
     *
 | 
						|
     *
 | 
						|
     * @OA\Post(
 | 
						|
     *      path="/api/v1/designs",
 | 
						|
     *      operationId="storeDesign",
 | 
						|
     *      tags={"designs"},
 | 
						|
     *      summary="Adds a design",
 | 
						|
     *      description="Adds an design to a company",
 | 
						|
     *      @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
 | 
						|
     *      @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
 | 
						|
     *      @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
 | 
						|
     *      @OA\Parameter(ref="#/components/parameters/include"),
 | 
						|
     *      @OA\Response(
 | 
						|
     *          response=200,
 | 
						|
     *          description="Returns the saved design object",
 | 
						|
     *          @OA\Header(header="X-API-Version", ref="#/components/headers/X-API-Version"),
 | 
						|
     *          @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"),
 | 
						|
     *          @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"),
 | 
						|
     *          @OA\JsonContent(ref="#/components/schemas/Design"),
 | 
						|
     *       ),
 | 
						|
     *       @OA\Response(
 | 
						|
     *          response=422,
 | 
						|
     *          description="Validation error",
 | 
						|
     *          @OA\JsonContent(ref="#/components/schemas/ValidationError"),
 | 
						|
     *
 | 
						|
     *       ),
 | 
						|
     *       @OA\Response(
 | 
						|
     *           response="default",
 | 
						|
     *           description="Unexpected Error",
 | 
						|
     *           @OA\JsonContent(ref="#/components/schemas/Error"),
 | 
						|
     *       ),
 | 
						|
     *     )
 | 
						|
     *
 | 
						|
     */
 | 
						|
    public function store(StoreDesignRequest $request)
 | 
						|
    {
 | 
						|
        $design = DesignFactory::create(auth()->user()->company()->id, auth()->user()->id);
 | 
						|
        $design->fill($request->all());
 | 
						|
        $design->save();
 | 
						|
 | 
						|
        return $this->itemResponse($design->fresh());
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * Remove the specified resource from storage.
 | 
						|
     *
 | 
						|
     * @param  int  $id
 | 
						|
     * @return \Illuminate\Http\Response
 | 
						|
     *
 | 
						|
     *
 | 
						|
     * @OA\Delete(
 | 
						|
     *      path="/api/v1/designs/{id}",
 | 
						|
     *      operationId="deleteDesign",
 | 
						|
     *      tags={"designs"},
 | 
						|
     *      summary="Deletes a design",
 | 
						|
     *      description="Handles the deletion of a design by id",
 | 
						|
     *      @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
 | 
						|
     *      @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
 | 
						|
     *      @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
 | 
						|
     *      @OA\Parameter(ref="#/components/parameters/include"),
 | 
						|
     *      @OA\Parameter(
 | 
						|
     *          name="id",
 | 
						|
     *          in="path",
 | 
						|
     *          description="The Design Hashed ID",
 | 
						|
     *          example="D2J234DFA",
 | 
						|
     *          required=true,
 | 
						|
     *          @OA\Schema(
 | 
						|
     *              type="string",
 | 
						|
     *              format="string",
 | 
						|
     *          ),
 | 
						|
     *      ),
 | 
						|
     *      @OA\Response(
 | 
						|
     *          response=200,
 | 
						|
     *          description="Returns a HTTP status",
 | 
						|
     *          @OA\Header(header="X-API-Version", ref="#/components/headers/X-API-Version"),
 | 
						|
     *          @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"),
 | 
						|
     *          @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"),
 | 
						|
     *       ),
 | 
						|
     *       @OA\Response(
 | 
						|
     *          response=422,
 | 
						|
     *          description="Validation error",
 | 
						|
     *          @OA\JsonContent(ref="#/components/schemas/ValidationError"),
 | 
						|
     *
 | 
						|
     *       ),
 | 
						|
     *       @OA\Response(
 | 
						|
     *           response="default",
 | 
						|
     *           description="Unexpected Error",
 | 
						|
     *           @OA\JsonContent(ref="#/components/schemas/Error"),
 | 
						|
     *       ),
 | 
						|
     *     )
 | 
						|
     *
 | 
						|
     */
 | 
						|
    public function destroy(DestroyDesignRequest $request, Design $design)
 | 
						|
    {
 | 
						|
        //may not need these destroy routes as we are using actions to 'archive/delete'
 | 
						|
        $design->is_deleted = true;
 | 
						|
        $design->delete();
 | 
						|
        $design->save();
 | 
						|
 | 
						|
        return response()->json([], 200);
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * Perform bulk actions on the list view
 | 
						|
     *
 | 
						|
     * @param BulkDesignRequest $request
 | 
						|
     * @return \Illuminate\Http\Response
 | 
						|
     *
 | 
						|
     *
 | 
						|
     * @OA\Post(
 | 
						|
     *      path="/api/v1/designs/bulk",
 | 
						|
     *      operationId="bulkDesigns",
 | 
						|
     *      tags={"designs"},
 | 
						|
     *      summary="Performs bulk actions on an array of designs",
 | 
						|
     *      description="",
 | 
						|
     *      @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
 | 
						|
     *      @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
 | 
						|
     *      @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
 | 
						|
     *      @OA\Parameter(ref="#/components/parameters/index"),
 | 
						|
     *      @OA\RequestBody(
 | 
						|
     *         description="User credentials",
 | 
						|
     *         required=true,
 | 
						|
     *         @OA\MediaType(
 | 
						|
     *             mediaType="application/json",
 | 
						|
     *             @OA\Schema(
 | 
						|
     *                 type="array",
 | 
						|
     *                 @OA\Items(
 | 
						|
     *                     type="integer",
 | 
						|
     *                     description="Array of hashed IDs to be bulk 'actioned",
 | 
						|
     *                     example="[0,1,2,3]",
 | 
						|
     *                 ),
 | 
						|
     *             )
 | 
						|
     *         )
 | 
						|
     *     ),
 | 
						|
     *      @OA\Response(
 | 
						|
     *          response=200,
 | 
						|
     *          description="The Design User response",
 | 
						|
     *          @OA\Header(header="X-API-Version", ref="#/components/headers/X-API-Version"),
 | 
						|
     *          @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"),
 | 
						|
     *          @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"),
 | 
						|
     *          @OA\JsonContent(ref="#/components/schemas/Design"),
 | 
						|
     *       ),
 | 
						|
     *       @OA\Response(
 | 
						|
     *          response=422,
 | 
						|
     *          description="Validation error",
 | 
						|
     *          @OA\JsonContent(ref="#/components/schemas/ValidationError"),
 | 
						|
     *       ),
 | 
						|
     *       @OA\Response(
 | 
						|
     *           response="default",
 | 
						|
     *           description="Unexpected Error",
 | 
						|
     *           @OA\JsonContent(ref="#/components/schemas/Error"),
 | 
						|
     *       ),
 | 
						|
     *     )
 | 
						|
     */
 | 
						|
    public function bulk()
 | 
						|
    {
 | 
						|
        $action = request()->input('action');
 | 
						|
        
 | 
						|
        $ids = request()->input('ids');
 | 
						|
        $designs = Design::withTrashed()->find($this->transformKeys($ids));
 | 
						|
        
 | 
						|
        $designs->each(function ($design, $key) use ($action) {
 | 
						|
            if (auth()->user()->can('edit', $design)) {
 | 
						|
                //$this->design_repo->{$action}($design);@todo
 | 
						|
            }
 | 
						|
        });
 | 
						|
        
 | 
						|
        return $this->listResponse(Design::withTrashed()->whereIn('id', $this->transformKeys($ids)));
 | 
						|
    }
 | 
						|
}
 |