1. Go to this page and download the library: Download klisl/laravel-widgets 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/ */
klisl / laravel-widgets example snippets
@widget('menu')
Klisl\Widgets\WidgetServiceProvider::class,
'test' => 'App\Widgets\TestWidget'
namespace App\Widgets;
use Klisl\Widgets\Contract\ContractWidget;
class TestWidget implements ContractWidget{
public function execute(){
return view('Widgets::test');
}
}
@widget('test')
namespace App\Widgets;
use Klisl\Widgets\Contract\ContractWidget;
class TestWidget implements ContractWidget{
public $num;
public function __construct ($data){
$this->num = $data['num'];
}
public function execute(){
return view('Widgets::test', [
'num' => $this->num
]);
}
}