1. Go to this page and download the library: Download rinvex/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/ */
rinvex / laravel-widgets example snippets
namespace App\Widgets;
use Rinvex\Widgets\Models\AbstractWidget;
class RecentPosts extends AbstractWidget
{
/**
* Treat this method as a normal PHP method, or a controller action.
* You may return view() or other content to render and display.
*/
public function make()
{
//
}
}
// add several widgets to the 'sidebar' group
Widget::group('sidebar')->addWidget(Widget::make('App\Widgets\RecentPosts'), 10);
Widget::group('sidebar')->addWidget(Widget::make('App\Widgets\LatestVisitors'), 20);
// Check if widget group is empty or not
Widget::group('sidebar')->isEmpty(); // bool
// Get widgets count in the widget group
Widget::group('sidebar')->count(); // int
// Check if there's any widget groups or not
Widget::groups()->isEmpty(); // bool
// Get widget groups count
Widget::groups()->count(); // int
ssh
php artisan make:widget RecentPosts
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.