PHP code example of asseco-voice / laravel-tags

1. Go to this page and download the library: Download asseco-voice/laravel-tags library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

asseco-voice / laravel-tags example snippets


// Routes
Route::post('models/{model}/tags', [ModelTagController::class, 'store']);

// Controller
public function store(Request $request, Model $model): JsonResponse
{
    $ids = Arr::get($request->validated(), 'tag_ids', []);

    $model->tags()->sync($ids);

    return response()->json('success');
}