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) {}