PHP code example of sinclairt / magic-views

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

    

sinclairt / magic-views example snippets

 composer dump-autoload 
 sh
public function index()
{
    $rows = User::where('votes', '>', 100)->paginate(15);

    return $this->indexView(compact('rows'));
}
 sh
public function create()
{
    return $this->createView();
}
 sh
public function edit($model)
{
    return $this->editView(compact('model'));
}
 sh
public function show($model)
{
    return $this->showView(compact('model'));
}
 $fields 
 sh
public $fields = [
    'username'              => 'text',
    'password'              => 'password',
    'email'                 => 'email',
    'password_confirmation' => 'password'
];
 roles.blade.php 
 $new = false; 
 sh
$presentUserId = 'userName';

return $this->indexView(compact('model', 'presentUserId'));
 sh
$additionalContentAfter = 'partials.product.options';

return $this->indexView(compact('rows', 'additionalContentAfter'));
 php artisan vendor:publish 
 stats.blade.php 
 php artisan vendor:publish 
 $this->statsView();