PHP code example of wamesk / laravel-route-resource

1. Go to this page and download the library: Download wamesk/laravel-route-resource 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/ */

    

wamesk / laravel-route-resource example snippets




return [
    // Data passed to user registration request
    'user' => [
        'name' => 'Testing User',
        'email' => '[email protected]',
        'password' => 'password123',
        // 'platform' => 'ios',
        // addition content...
    ],

    // Route Group Rules
    'group' => [
        'prefix' => 'api/v1',
        'middleware' =>  'auth:api',
        // addition content...
    ],

    // Add route resources
    'resources' => [
        /*'
        // EXAMPLE USAGE:
        posts' => [
            'controller' => '\App\Http\Controllers\v1\PostController::class',  <-- Resource Controller
            'store_data' => [                                                  <-- Array to Store Data
                'title' => 'string|


/** 
 * Get Post Index
 * Returns status code 200 
 */
public function index(\Illuminate\Http\Request $request) {}

/** 
 * Store Post in Database
 * Returns status code 201 
 */
public function store(\Illuminate\Http\Request $request) {}

/** 
 * Get one Post by ID
 * Returns status code 200 
 */
public function show(\Illuminate\Http\Request $request, string $postId) {}

/** 
 * Update Post by ID
 * Returns status code 200 
 */
public function update(\Illuminate\Http\Request $request, string $postId) {}

/** 
 * Delete Post by ID
 * Returns status code 200 
 */
public function delete(\Illuminate\Http\Request $request, string $postId) {}

/** 
 * Restore Post by ID
 * Returns status code 200
 * Only if config has "soft_delete" to "true" 
 */
public function restore(\Illuminate\Http\Request $request, string $postId) {}

/** 
 * Force Delete Post by ID
 * Returns status code 200 
 * Only if config has "soft_delete" to "true"
 */
public function forceDelete(\Illuminate\Http\Request $request, string $postId) {}
bash
php artisan vendor:publish --provider="Wame\LaravelRouteResource\LaravelRouteResourceServiceProvider" --tag="config"
xml
<testsuite name="LaravelRouteResource">
    <directory suffix="Test.php">./vendor/wamesk/laravel-route-resource</directory>
</testsuite>
xml
<php>
    <env name="APP_KEY" value="base64:2U6xa56Ic3e96220e/T58R7gEayJ2aBpl331GaMnswc="/>
    <env name="APP_ENV" value="local"/>
    <env name="BCRYPT_ROUNDS" value="4"/>
    <env name="CACHE_DRIVER" value="array"/>
    <env name="DB_CONNECTION" value="mysql"/>
    <env name="DB_DATABASE" value="database_name"/>
    <env name="MAIL_MAILER" value="array"/>
    <env name="QUEUE_CONNECTION" value="sync"/>
    <env name="SESSION_DRIVER" value="array"/>
    <env name="TELESCOPE_ENABLED" value="false"/>
</php>
bash
composer dump-autoload
bash
php artisan test