Skip to content

Instantly share code, notes, and snippets.

View mansha99's full-sized avatar

Manish Sharma mansha99

View GitHub Profile
@mansha99
mansha99 / test.html
Created October 18, 2016 02:57
test
This is test
@mansha99
mansha99 / Inventors.php
Created May 1, 2023 12:41
Simple Livewire Component : App\Http\Livewire\Inventors
<?php
namespace App\Http\Livewire;
use Livewire\Component;
class Inventors extends Component
{
//properties
public $inventor;
@mansha99
mansha99 / inventors.blade.php
Created May 1, 2023 15:04
resources/views/livewire/inventors.blade.php
<div>
<select wire:model="invention">
@foreach ($list as $k => $v)
<option value="{{ $k }}">{{ $k }}</option>
@endforeach
</select> invented by
{{ $inventor }}
</div>
@mansha99
mansha99 / welcome.blade.php
Last active May 1, 2023 19:00
resources/views/welcome.blade.php
<html>
<head>
@livewireStyles
@livewireScripts
</head>
<body>
<livewire:inventors />
</body>
@mansha99
mansha99 / App\Http\Livewire\Calculator.php
Created May 13, 2023 18:02
A Laravel Livewire component displaying Livewire validation in action
<?php
namespace App\Http\Livewire;
use Livewire\Component;
class Calculator extends Component
{
public $n1;
public $n2;
@mansha99
mansha99 / App\Http\Livewire\Sender.php
Created May 13, 2023 18:05
A Laravel Livewire component acting as publisher (Generator) of event
<?php
namespace App\Http\Livewire;
use Livewire\Component;
class Sender extends Component
{
public function fireTimestampEvent()
{
@mansha99
mansha99 / resources\views\livewire\sender.blade.php
Created May 13, 2023 18:11
View for Livewire Sender Component
<div style="background: #aaccff;padding:20;width:240px">
<h5>Sender</h5>
<button wire:click="fireTimestampEvent()">Gnerate Event </button>
</div>
@mansha99
mansha99 / App\Http\Livewire\Receiver.php
Created May 13, 2023 18:12
Livewire components receiving Event
<?php
namespace App\Http\Livewire;
use Livewire\Component;
class Receiver extends Component
{
public $message="Received no event so far";
public $timeStamp='';
@mansha99
mansha99 / resources\views\livewire\receiver.blade.php
Created May 13, 2023 18:13
View for Livewire Receiver Component
<div style="background: #ffaacc;padding:20;width:240px">
<h5>Receiver</h5>
{{$message}} &nbsp;&nbsp;{{$timeStamp}}
</div>
@mansha99
mansha99 / resources\views\livewire\calculator.blade.php
Created May 13, 2023 18:28
View for Livewire Calculator Component
<div style="background: #aaffcc;padding:20;width:240px">
<h5>Calculator Component</h5>
<form wire:submit.prevent="multiply">
First<br/>
<input type="text" wire:model="n1" />
<br/>
@error('n1')
{{ $message }}
@enderror
<br/>Second<br/>