-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3b5844f
commit f6d933b
Showing
108 changed files
with
5,058 additions
and
1,664 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace App\Events; | ||
|
||
use App\Models\Blog; | ||
use Illuminate\Broadcasting\Channel; | ||
use Illuminate\Broadcasting\InteractsWithSockets; | ||
use Illuminate\Broadcasting\PresenceChannel; | ||
use Illuminate\Broadcasting\PrivateChannel; | ||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast; | ||
use Illuminate\Foundation\Events\Dispatchable; | ||
use Illuminate\Queue\SerializesModels; | ||
|
||
class BlogWasCreated | ||
{ | ||
use Dispatchable, InteractsWithSockets, SerializesModels; | ||
|
||
/** | ||
* Create a new event instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct(public Blog $blog) | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Get the channels the event should broadcast on. | ||
* | ||
* @return \Illuminate\Broadcasting\Channel|array | ||
*/ | ||
public function broadcastOn() | ||
{ | ||
return new PrivateChannel('channel-name'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use Illuminate\Http\Request; | ||
|
||
class NotificationController extends Controller | ||
{ | ||
public function index() | ||
{ | ||
return view("notifications.index"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use Illuminate\Http\Request; | ||
|
||
class UserController extends Controller | ||
{ | ||
public function index() | ||
{ | ||
return view('users.index'); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?php | ||
|
||
namespace App\Http\Livewire\Blogs; | ||
|
||
use App\Events\BlogWasCreated; | ||
use App\Models\Blog; | ||
use Livewire\Component; | ||
use Livewire\WithFileUploads; | ||
use Illuminate\Support\Str; | ||
|
||
class Create extends Component | ||
{ | ||
use WithFileUploads; | ||
|
||
public $title; | ||
|
||
public $body = "# hello peoples"; | ||
|
||
public $message; | ||
|
||
public $photo; | ||
public $tags = []; | ||
|
||
protected $rules = [ | ||
// 'cover_image' => ['required', 'mimes:png,jpg,svg,gif', 'max:2048'], | ||
'title' => ['required', 'max:200', 'min:20'], | ||
'body' => ['required', 'min:20'], | ||
]; | ||
|
||
public function render() | ||
{ | ||
return view('livewire.blogs.create'); | ||
} | ||
|
||
public function updatedPhoto() | ||
|
||
{ | ||
$this->validate([ | ||
'photo' => 'image|max:1024', // 1MB Max | ||
]); | ||
} | ||
public function submit() | ||
{ | ||
$this->validate(); | ||
$blog = Blog::create([ | ||
'title' => $this->title, | ||
'body' => $this->body, | ||
'user_id' => auth()->id() | ||
]); | ||
BlogWasCreated::dispatch($blog); | ||
return redirect()->to('/blogs/' . Str::slug($this->title, '-') . '-' . $blog->id); | ||
} | ||
public function draft() | ||
{ | ||
$this->validate(); | ||
$blog = Blog::create([ | ||
'title' => $this->title, | ||
'body' => $this->body, | ||
'status' => "drafted", | ||
'user_id' => auth()->id(), | ||
|
||
]); | ||
$this->emit('changed'); | ||
session()->flash('message', 'Social info updated successfully'); | ||
return redirect()->to('/settings?tab=drafts'); | ||
} | ||
} |
Oops, something went wrong.