1. Go to this page and download the library: Download wp-kit/magic-meta 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/ */
wp-kit / magic-meta example snippets
composer
namespace Theme\Models;
use WPEloquent\Model\Post;
use WPKit\MagicMeta\Traits\IsMagic;
use WPKit\MagicMeta\Traits\TransformsQuery;
class SomePostType extends Post {
use IsMagic;
use TransformsQuery;
protected $magic_meta = [
'_some_meta_key' => 'appended_key',
'_location' => 'location'
];
}
namespace App\Controllers;
use Illuminate\Routing\Controller;
use Illuminate\Http\Request;
use App\Models\SomePostType;
class SomePostTypeController extends Controller {
public function index(Request $request) {
return response()->json( SomePostType::select( 'posts.*' )->type( 'some_type' )->transformQuery( $request ) );
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.