PHP code example of typerocket / laravel

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

    

typerocket / laravel example snippets


'providers' => [
    // Other Service Providers

    TypeRocket\Service::class,
],

$paths = Config::getPaths();

// type ( js || css), id, path
Assets::addToFooter('js', 'typerocket-core', $paths['urls']['js'] . '/typerocket.js');
Assets::addToHead('js', 'typerocket-global', $paths['urls']['js'] . '/global.js');

// model, action ( create || update ), id, path
$form = new \TypeRocket\Form('Post', 'update', $id, '/posts/' . $id);

<div class="typerocket-container">
    {!! $form->open() !!}
    {!! $form->text('title')->setLabel('Post Title') !!}
    {!! $form->checkbox('publish')->setText('Published') !!}
    {!! $form->close('Submit') !!}
</div>

class PostController extends Controller
{
    public function create(Request $request)
    {
        $form = new \TypeRocket\Form('Post', 'create', null, '/posts/');
        $form->setRequest($request); // set request
        return view('posts.create', ['form' => $form]);
    }
}

class PostController extends Controller
{

    public function store(Request $request)
    {
        $tr = $request->input('tr');

        $validator = \Validator::make($tr, [
            'title' => 'ic();
        $post->title = $tr['title'];
        $post->save();

        header('Location: /posts/');
    }

}

Route::post('matrix_api/{group}/{type}', function($group, $type) {
    (new TypeRocket\Matrix())->route($group, $type);
});



namespace App\Http\Middleware;

use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier;

class VerifyCsrfToken extends BaseVerifier
{
    /**
     * The URIs that should be excluded from CSRF verification.
     *
     * @var array
     */
    protected $except = [
        'matrix_api/*' // added
    ];
}

$paths = \TypeRocket\Config::getPaths();
\TypeRocket\Assets::addToFooter('js', 'typerocket-image', $paths['urls']['js'] . '/image.js');

php artisan vendor:publish --provider="TypeRocket\Service"