Skip to content

Instantly share code, notes, and snippets.

View madi-madi's full-sized avatar
:octocat:
Available To Hire

Ibrahim S Madi madi-madi

:octocat:
Available To Hire
View GitHub Profile
//code 3karatcom wordpress
@madi-madi
madi-madi / PushNotification.php
Last active December 24, 2020 14:22
PushNotification
<?php
namespace App\Notifications;
use App\Post;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
@madi-madi
madi-madi / LogNotification.php
Last active December 25, 2020 15:43
LogNotification
<?php
namespace App\Listeners;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Events\NotificationSent;
use Illuminate\Queue\InteractsWithQueue;
use FCMAPP;
class LogNotification implements ShouldQueue
{
@madi-madi
madi-madi / PostObserver.php
Last active December 25, 2020 15:50
PostObserver
<?php
namespace App\Observers;
use App\Post;
use App\User;
use App\Jobs\NewPostJob;
use Illuminate\Support\Facades\Notification;
use App\Notifications\PushNotification;
@madi-madi
madi-madi / ViewServiceProvider.php
Last active December 25, 2020 16:36
ViewServiceProvider
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\View;
use Illuminate\Support\ServiceProvider;
use App\Http\View\Composers\ProfileComposer;
class ViewServiceProvider extends ServiceProvider
@madi-madi
madi-madi / app.blade.php
Created December 24, 2020 11:11
layout app.blade.php
<!doctype html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- CSRF Token -->
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>{{ config('app.name', 'Laravel') }}</title>
@madi-madi
madi-madi / send fcm all Topic.php
Created December 26, 2020 16:45
send fcm all Topic
<?php
/*
curl -X POST --header "Authorization: key=<KeyValue>" \
--Header "Content-Type: application/json" \
https://fcm.googleapis.com/fcm/send \
-d "{\"condition\":\"!('anytopicyoudontwanttouse' in topics)\",\"notification\":{\"title\":\"Hello\",\"body\":\"Yellow\"}}"
*/
$notification = [
@madi-madi
madi-madi / nuxt and laravel nginx deploy.txt
Created January 1, 2021 19:44
DEPLOYING LARAVEL AND NUXT ON LINUX
DEPLOYING LARAVEL AND NUXT ON LINUX
SERVER – Start to FInish
Buy a server on Digital Ocean
1. Go to Digital Ocean https://m.do.co/c/5b428a74fc09 to sign up. Use this link to get
$100 in free credit.
2. Create a new Project
3. Create a new Droplet and OS
a. Click on “Get started with a Droplet”.
b. Choose Ubuntu LTS
c. Select plan ($5/mo is ok)
@madi-madi
madi-madi / fix-ssl-cert-snakeoil.key-ubuntu-postgresql.sh
Created January 10, 2021 13:12
Fix postgresql error FATAL: could not access private key file "/etc/ssl/private/ssl-cert-snakeoil.key": Permission denied
# > It happened to me and it turned out that I removed erroneously the postgres user from "ssl-cert" group, set it back with
gpasswd -a postgres ssl-cert
# Fixed ownership and mode
sudo chown root:ssl-cert /etc/ssl/private/ssl-cert-snakeoil.key
sudo chmod 740 /etc/ssl/private/ssl-cert-snakeoil.key
# now postgresql starts! (and install command doesn't fail anymore)
sudo /etc/init.d/postgresql start