PHP code example of protonemedia / laravel-splade-core
1. Go to this page and download the library: Download protonemedia/laravel-splade-core 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/ */
protonemedia / laravel-splade-core example snippets
namespace App\View\Components;
use Illuminate\View\Component;
use ProtoneMedia\SpladeCore\Attributes\Vue;
class UserProfile extends Component
{
#[Vue]
public function notify(string $message)
{
auth()->user()->notify($message);
}
public function render()
{
return view('components.user-profile');
}
}
namespace App\View\Components;
use Illuminate\View\Component;
use ProtoneMedia\SpladeCore\Attributes\VueProp;
class UserProfile extends Component
{
#[VueProp]
public string $defaultMessage = 'Hey there!'
}
namespace App\View\Components;
use Illuminate\View\Component;
use ProtoneMedia\SpladeCore\Attributes\VueRef;
class UserProfile extends Component
{
#[VueRef]
public string $notification = 'Hey there!'
#[Vue]
public function notify()
{
auth()->user()->notify($this->notification);
}
public function render()
{
return view('components.user-profile');
}
}
use ProtoneMedia\SpladeCore\Http\Refreshable::class;
Route::get('/login', LoginController::class)->middleware(Refreshable::class);