Skip to content
This repository was archived by the owner on Nov 26, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
eda5cd5
Publish Packages Configuration
nasrulhazim Dec 8, 2017
6853284
Publish MIgration Files
nasrulhazim Dec 8, 2017
2d0b0ac
Publish Mailing Views
nasrulhazim Dec 8, 2017
7f66101
Publish Notification View
nasrulhazim Dec 8, 2017
9ec6fce
Publish Pagination Views
nasrulhazim Dec 8, 2017
d3bcabd
Added README
nasrulhazim Dec 8, 2017
b02fffe
Configure Application Config
nasrulhazim Dec 8, 2017
6ab636d
Added Spatie Capture Referer Middleware
nasrulhazim Dec 8, 2017
6060517
Restructure Models
nasrulhazim Dec 8, 2017
11a0ef8
Added HasRoles Trait to User Model
nasrulhazim Dec 8, 2017
d3cd90c
Added Artisan Extended
nasrulhazim Dec 8, 2017
f5e6d42
Update
nasrulhazim Dec 8, 2017
cf68de3
Added Roles Seeder
nasrulhazim Dec 8, 2017
712d1bf
Extend LogsActivity Trait
nasrulhazim Dec 8, 2017
43cd06a
Added LogsActivityExtended to User Model
nasrulhazim Dec 8, 2017
ea5278f
Added Auth Scaffold
nasrulhazim Dec 8, 2017
bda4c93
Update User Namespace
nasrulhazim Dec 8, 2017
050f756
Move Welcome to Controller instead of Closure
nasrulhazim Dec 8, 2017
54eccca
Added Link as Helper
nasrulhazim Dec 8, 2017
11b459a
Added Table Component
nasrulhazim Dec 8, 2017
8dc9ac1
Refactor Navbar to Individual Blade File
nasrulhazim Dec 8, 2017
b714d4d
Added Log View for User
nasrulhazim Dec 8, 2017
9cc2419
Removed Closure Routes
nasrulhazim Dec 8, 2017
d62c8cf
Added Hashids and Helpers
nasrulhazim Dec 8, 2017
45a4ebc
Added Hashids and Helpers
nasrulhazim Dec 8, 2017
04aa8e5
Added Hashids Service
nasrulhazim Dec 8, 2017
5d8638a
Extend HasSlug Trait
nasrulhazim Dec 8, 2017
16d6bf6
Added Document Configuration File
nasrulhazim Dec 8, 2017
a3d7df9
Added Helpers
nasrulhazim Dec 8, 2017
7b0ab14
Use str_slug_fqcn to generate log name to use
nasrulhazim Dec 8, 2017
a62fb45
Added HasSlugExtended
nasrulhazim Dec 8, 2017
ab58d2b
Added Macro Contract
nasrulhazim Dec 8, 2017
988a5a1
Added Macro on Database Schema Blueprint
nasrulhazim Dec 8, 2017
a0d7f69
Added Hashids Observer
nasrulhazim Dec 8, 2017
21cc2c7
Added Reference Observer
nasrulhazim Dec 8, 2017
a9c929e
Added Observer Kernel
nasrulhazim Dec 8, 2017
a8aa66f
Added Macro Service Provider
nasrulhazim Dec 8, 2017
b49577d
Added Observer Service Provider
nasrulhazim Dec 8, 2017
bbbc4ff
Added Document Prefix Settings
nasrulhazim Dec 8, 2017
8725ef6
Added Hashslug to user migration
nasrulhazim Dec 8, 2017
8d6d3ba
Added Slug Blueprint
nasrulhazim Dec 8, 2017
53aa90f
Added Hashslug to Spatie Media
nasrulhazim Dec 8, 2017
555ecd9
Added Description to Logs Activity
nasrulhazim Dec 8, 2017
1ae6276
Register Macro and Observer Service Provider
nasrulhazim Dec 8, 2017
558508b
Added hashids Conifguration
nasrulhazim Dec 8, 2017
5155435
Added Soft Delete to User
nasrulhazim Dec 8, 2017
a61ebf9
Added Hashslug and Slug Field
nasrulhazim Dec 8, 2017
200679c
Assign Default Role to Newly Registered User
nasrulhazim Dec 8, 2017
65462d6
Seed Roles Permissions
nasrulhazim Dec 8, 2017
6e3c7ab
Added Avatar Controller
nasrulhazim Dec 8, 2017
5f311a0
Addad HasThumb Trait
nasrulhazim Dec 8, 2017
d318dd7
Added Small Panel Component
nasrulhazim Dec 8, 2017
18fd2cd
Added HasMedia Trait, implements HasMediaConversions
nasrulhazim Dec 8, 2017
ecad774
Added Avatar View
nasrulhazim Dec 8, 2017
6e087c4
Refactor Log View
nasrulhazim Dec 8, 2017
7a6793f
Added Avatar Route and Refactor User Namespace Route
nasrulhazim Dec 8, 2017
60e329e
Rename HasThumb
nasrulhazim Dec 9, 2017
25cf0b9
Added Sweet Alert
nasrulhazim Dec 9, 2017
24ac274
Added Sweet Alert
nasrulhazim Dec 9, 2017
0558679
Added Avatar Controller
nasrulhazim Dec 9, 2017
828f598
Added Upload Avatar Form
nasrulhazim Dec 9, 2017
a6c5417
Added getLastMedia and getLastMediaUrl method
nasrulhazim Dec 10, 2017
21dceaa
Remove slug field from Media
nasrulhazim Dec 10, 2017
e8234b3
Dispay Avatar on Navbar
nasrulhazim Dec 10, 2017
02cfb0c
Create storage link after create project
nasrulhazim Dec 10, 2017
0182298
Display Avatar on Navbar
nasrulhazim Dec 10, 2017
d0f1604
Added userlog to capture current user activities.
nasrulhazim Dec 11, 2017
eb34a59
Updated avatar controller to log on store and alert on success.
nasrulhazim Dec 11, 2017
b556b87
Sort log by latest
nasrulhazim Dec 11, 2017
2b77ee4
Added missing panel_title
nasrulhazim Dec 11, 2017
d0d0827
Update README
nasrulhazim Dec 11, 2017
337a49f
Log user activities on success login & logout, failed login and reset…
nasrulhazim Dec 16, 2017
0544141
Update Namespace
nasrulhazim Dec 16, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ MAIL_ENCRYPTION=null
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=

DOCUMENT_REFERENCE_PREFIX=DOCUMENT
DOCUMENT_SEQUENCE_LENGTH=6
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Web Application Boilerplate

A boilerplate to speed up development.

# Packages

Most of the packages from Spatie.

1. Laravel Permission
2. Laravel Media Library
3. Laravel Activity
4. Laravel Newsletter
5. Laravel Analytics
6. Laravel Response Cache
7. Laravel Sluggable
8. Laravel Menu
9. Laravel Collection Macros
10. Laravel Google Calendar
11. Laravel Html
12. Image Optimizer

# Google API

Create [Google Service Account Credentials](https://console.developers.google.com/apis/dashboard?project=karnival-usahawan-desa) for:

1. [Google Calendar](https://github.com/spatie/laravel-google-calendar#how-to-obtain-the-credentials-to-communicate-with-google-calendar)
2. [Google Analytic](https://github.com/spatie/laravel-analytics#how-to-obtain-the-credentials-to-communicate-with-google-analytics)

# TODO

1. Media Library for User
2 changes: 1 addition & 1 deletion app/Console/Kernel.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Console;
namespace OSI\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
Expand Down
11 changes: 11 additions & 0 deletions app/Contracts/MacroContract.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace OSI\Contracts;

/**
* MacroContract
*/
interface MacroContract
{
public static function registerMacros();
}
2 changes: 1 addition & 1 deletion app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Exceptions;
namespace OSI\Exceptions;

use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Auth/ForgotPasswordController.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace App\Http\Controllers\Auth;
namespace OSI\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use OSI\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;

class ForgotPasswordController extends Controller
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Auth/LoginController.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace App\Http\Controllers\Auth;
namespace OSI\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use OSI\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;

class LoginController extends Controller
Expand Down
20 changes: 10 additions & 10 deletions app/Http/Controllers/Auth/RegisterController.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

namespace App\Http\Controllers\Auth;
namespace OSI\Http\Controllers\Auth;

use App\User;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Validator;
use OSI\Http\Controllers\Controller;
use OSI\Models\User;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Support\Facades\Validator;

class RegisterController extends Controller
{
Expand All @@ -18,7 +18,7 @@ class RegisterController extends Controller
| validation and creation. By default this controller uses a trait to
| provide this functionality without requiring any additional code.
|
*/
*/

use RegistersUsers;

Expand Down Expand Up @@ -48,8 +48,8 @@ public function __construct()
protected function validator(array $data)
{
return Validator::make($data, [
'name' => 'required|string|max:255',
'email' => 'required|string|email|max:255|unique:users',
'name' => 'required|string|max:255',
'email' => 'required|string|email|max:255|unique:users',
'password' => 'required|string|min:6|confirmed',
]);
}
Expand All @@ -58,13 +58,13 @@ protected function validator(array $data)
* Create a new user instance after a valid registration.
*
* @param array $data
* @return \App\User
* @return \OSI\Models\User
*/
protected function create(array $data)
{
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'name' => $data['name'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
]);
}
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Auth/ResetPasswordController.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace App\Http\Controllers\Auth;
namespace OSI\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use OSI\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ResetsPasswords;

class ResetPasswordController extends Controller
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Controller.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Http\Controllers;
namespace OSI\Http\Controllers;

use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
Expand Down
28 changes: 28 additions & 0 deletions app/Http/Controllers/HomeController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace OSI\Http\Controllers;

use Illuminate\Http\Request;

class HomeController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}

/**
* Show the application dashboard.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
return view('home');
}
}
37 changes: 37 additions & 0 deletions app/Http/Controllers/User/AvatarController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace OSI\Http\Controllers\User;

use OSI\Http\Controllers\Controller;
use Illuminate\Http\Request;

class AvatarController extends Controller
{
public function __construct()
{
$this->middleware(['auth']);
}

public function show()
{
return view('users.avatar');
}

public function store(Request $request)
{
$this->validate($request, [
'avatar' => 'required|image|mimes:jpg,png',
]);

auth()->user()->addMediaFromRequest('avatar')
->preservingOriginal()
->usingFileName('avatar.png')
->toMediaCollection('avatar');

userlog(auth()->user(), 'Uploaded new avatar');

alert()->success('New Avatar Uploaded');

return redirect()->route('show.avatar');
}
}
19 changes: 19 additions & 0 deletions app/Http/Controllers/User/LogController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace OSI\Http\Controllers\User;

use OSI\Http\Controllers\Controller;

class LogController extends Controller
{
public function __construct()
{
$this->middleware(['auth']);
}

public function __invoke()
{
$logs = auth()->user()->activity->sortByDesc('created_at');
return view('users.log', compact('logs'));
}
}
11 changes: 11 additions & 0 deletions app/Http/Controllers/WelcomeController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace OSI\Http\Controllers;

class WelcomeController extends Controller
{
public function __invoke()
{
return view('welcome');
}
}
22 changes: 12 additions & 10 deletions app/Http/Kernel.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Http;
namespace OSI\Http;

use Illuminate\Foundation\Http\Kernel as HttpKernel;

Expand All @@ -16,9 +16,9 @@ class Kernel extends HttpKernel
protected $middleware = [
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\OSI\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
\App\Http\Middleware\TrustProxies::class,
\OSI\Http\Middleware\TrustProxies::class,
];

/**
Expand All @@ -28,13 +28,15 @@ class Kernel extends HttpKernel
*/
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\OSI\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
// \Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\OSI\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
\Spatie\Referer\CaptureReferer::class,
\UxWeb\SweetAlert\ConvertMessagesIntoSweetAlert::class,
],

'api' => [
Expand All @@ -51,11 +53,11 @@ class Kernel extends HttpKernel
* @var array
*/
protected $routeMiddleware = [
'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \OSI\Http\Middleware\RedirectIfAuthenticated::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
];
}
2 changes: 1 addition & 1 deletion app/Http/Middleware/EncryptCookies.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Http\Middleware;
namespace OSI\Http\Middleware;

use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Middleware/RedirectIfAuthenticated.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Http\Middleware;
namespace OSI\Http\Middleware;

use Closure;
use Illuminate\Support\Facades\Auth;
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Middleware/TrimStrings.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Http\Middleware;
namespace OSI\Http\Middleware;

use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Middleware/TrustProxies.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Http\Middleware;
namespace OSI\Http\Middleware;

use Illuminate\Http\Request;
use Fideloper\Proxy\TrustProxies as Middleware;
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Middleware/VerifyCsrfToken.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Http\Middleware;
namespace OSI\Http\Middleware;

use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;

Expand Down
29 changes: 29 additions & 0 deletions app/Listeners/AssignDefaultRole.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace OSI\Listeners;

use Illuminate\Auth\Events\Registered;

class AssignDefaultRole
{
/**
* Create the event listener.
*
* @return void
*/
public function __construct()
{
//
}

/**
* Handle the event.
*
* @param Registered $event
* @return void
*/
public function handle(Registered $event)
{
$event->user->assignRole('user');
}
}
Loading