Skip to content

Commit af90f82

Browse files
committed
wip
1 parent 5c2a868 commit af90f82

24 files changed

+729
-206
lines changed

README.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
# Laravel + Livewire Starter Kit
1+
# Podium
22

3-
## Introduction
3+
An example app for fielding questions from your audience.
44

5-
Our Laravel + [Livewire](https://livewire.laravel.com) starter kit provides a robust, modern starting point for building Laravel applications with a Livewire frontend.
5+
## Installation
66

7-
Livewire is a powerful way of building dynamic, reactive, frontend UIs using just PHP. It's a great fit for teams that primarily use Blade templates and are looking for a simpler alternative to JavaScript-driven SPA frameworks like React and Vue.
7+
After cloning this repo, run the following commands from your project root:
88

9-
This Livewire starter kit utilizes Livewire 3, Laravel Volt, TypeScript, Tailwind, and the [Flux UI](https://fluxui.dev) component library.
9+
```bash
10+
cp .env.example .env
11+
composer install
12+
php artisan key:generate
13+
touch database/database.sqlite
14+
php artisan migrate --seed
15+
php artisan flux:activate
16+
npm install
17+
npm run dev
18+
```
1019

11-
## Official Documentation
20+
Now, open the project in your browser (Typically `http://podium.test`) and use the following credentials to log in:
1221

13-
Documentation for all Laravel starter kits can be found on the [Laravel website](https://laravel.com/docs/starter-kits).
14-
15-
## Contributing
16-
17-
Thank you for considering contributing to our starter kit! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
18-
19-
## Code of Conduct
20-
21-
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
22-
23-
## License
24-
25-
The Laravel + Livewire starter kit is open-sourced software licensed under the MIT license.
22+
```
23+
24+
Pass: password
25+
```

app/Models/Question.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,33 @@ public function user()
1616
{
1717
return $this->belongsTo(User::class);
1818
}
19+
20+
public function votes()
21+
{
22+
return $this->hasMany(Vote::class);
23+
}
24+
25+
public function hasVoted(User $user)
26+
{
27+
return $this->votes()->where('user_id', $user->id)->exists();
28+
}
29+
30+
public function vote(User $user)
31+
{
32+
$this->votes()->create([
33+
'user_id' => $user->id,
34+
]);
35+
}
36+
37+
public function unvote(User $user)
38+
{
39+
$this->votes()->where('user_id', $user->id)->delete();
40+
}
41+
42+
public function approve()
43+
{
44+
$this->update([
45+
'is_approved' => true,
46+
]);
47+
}
1948
}

app/Models/User.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,9 @@ public function questions()
6262
{
6363
return $this->hasMany(Question::class);
6464
}
65+
66+
public function votes()
67+
{
68+
return $this->hasMany(Vote::class);
69+
}
6570
}

app/Models/Vote.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
namespace App\Models;
4+
5+
use Illuminate\Database\Eloquent\Factories\HasFactory;
6+
use Illuminate\Database\Eloquent\Model;
7+
8+
class Vote extends Model
9+
{
10+
/** @use HasFactory<\Database\Factories\VoteFactory> */
11+
use HasFactory;
12+
13+
protected $guarded = [];
14+
15+
public function user()
16+
{
17+
return $this->belongsTo(User::class);
18+
}
19+
20+
public function question()
21+
{
22+
return $this->belongsTo(Question::class);
23+
}
24+
}

composer.json

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
"php": "^8.2",
1313
"laravel/framework": "^12.0",
1414
"laravel/tinker": "^2.10.1",
15-
"livewire/flux": "dev-main",
16-
"livewire/flux-pro": "dev-main",
15+
"livewire/flux": "^2.0.3",
16+
"livewire/flux-pro": "^2.0",
17+
"livewire/livewire": "^3.5.19",
1718
"livewire/volt": "^1.6.7"
1819
},
1920
"require-dev": {
@@ -75,13 +76,9 @@
7576
"minimum-stability": "dev",
7677
"prefer-stable": true,
7778
"repositories": {
78-
"flux": {
79-
"type": "path",
80-
"url": "../flux"
81-
},
8279
"flux-pro": {
83-
"type": "path",
84-
"url": "../flux-pro"
80+
"type": "composer",
81+
"url": "https://composer.fluxui.dev"
8582
}
8683
}
8784
}

0 commit comments

Comments
 (0)