Skip to content

Commit c8e1c17

Browse files
author
Povilas Korop
committed
First commit
0 parents  commit c8e1c17

File tree

1,177 files changed

+262120
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,177 files changed

+262120
-0
lines changed

.env.example

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
APP_NAME=Laravel
2+
APP_ENV=local
3+
APP_KEY=
4+
APP_DEBUG=true
5+
APP_LOG_LEVEL=debug
6+
APP_URL=http://localhost
7+
8+
DB_CONNECTION=mysql
9+
DB_HOST=127.0.0.1
10+
DB_PORT=3306
11+
DB_DATABASE=homestead
12+
DB_USERNAME=homestead
13+
DB_PASSWORD=secret
14+
15+
BROADCAST_DRIVER=log
16+
CACHE_DRIVER=file
17+
SESSION_DRIVER=file
18+
QUEUE_DRIVER=sync
19+
20+
REDIS_HOST=127.0.0.1
21+
REDIS_PASSWORD=null
22+
REDIS_PORT=6379
23+
24+
MAIL_DRIVER=smtp
25+
MAIL_HOST=smtp.mailtrap.io
26+
MAIL_PORT=2525
27+
MAIL_USERNAME=null
28+
MAIL_PASSWORD=null
29+
MAIL_ENCRYPTION=null
30+
31+
PUSHER_APP_ID=
32+
PUSHER_APP_KEY=
33+
PUSHER_APP_SECRET=

.gitattributes

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
* text=auto
2+
*.css linguist-vendored
3+
*.scss linguist-vendored
4+
*.js linguist-vendored
5+
CHANGELOG.md export-ignore

.gitignore

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/node_modules
2+
/public/hot
3+
/public/storage
4+
/storage/*.key
5+
/vendor
6+
/.idea
7+
/.vagrant
8+
Homestead.json
9+
Homestead.yaml
10+
npm-debug.log
11+
.env

app/Console/Kernel.php

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
namespace App\Console;
4+
5+
use Illuminate\Console\Scheduling\Schedule;
6+
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
7+
8+
class Kernel extends ConsoleKernel
9+
{
10+
/**
11+
* The Artisan commands provided by your application.
12+
*
13+
* @var array
14+
*/
15+
protected $commands = [
16+
//
17+
];
18+
19+
/**
20+
* Define the application's command schedule.
21+
*
22+
* @param \Illuminate\Console\Scheduling\Schedule $schedule
23+
* @return void
24+
*/
25+
protected function schedule(Schedule $schedule)
26+
{
27+
// $schedule->command('inspire')
28+
// ->hourly();
29+
}
30+
31+
/**
32+
* Register the Closure based commands for the application.
33+
*
34+
* @return void
35+
*/
36+
protected function commands()
37+
{
38+
require base_path('routes/console.php');
39+
}
40+
}

app/Exceptions/Handler.php

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?php
2+
3+
namespace App\Exceptions;
4+
5+
use Exception;
6+
use Illuminate\Auth\AuthenticationException;
7+
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
8+
9+
class Handler extends ExceptionHandler
10+
{
11+
/**
12+
* A list of the exception types that should not be reported.
13+
*
14+
* @var array
15+
*/
16+
protected $dontReport = [
17+
\Illuminate\Auth\AuthenticationException::class,
18+
\Illuminate\Auth\Access\AuthorizationException::class,
19+
\Symfony\Component\HttpKernel\Exception\HttpException::class,
20+
\Illuminate\Database\Eloquent\ModelNotFoundException::class,
21+
\Illuminate\Session\TokenMismatchException::class,
22+
\Illuminate\Validation\ValidationException::class,
23+
];
24+
25+
/**
26+
* Report or log an exception.
27+
*
28+
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
29+
*
30+
* @param \Exception $exception
31+
* @return void
32+
*/
33+
public function report(Exception $exception)
34+
{
35+
parent::report($exception);
36+
}
37+
38+
/**
39+
* Render an exception into an HTTP response.
40+
*
41+
* @param \Illuminate\Http\Request $request
42+
* @param \Exception $exception
43+
* @return \Illuminate\Http\Response
44+
*/
45+
public function render($request, Exception $exception)
46+
{
47+
return parent::render($request, $exception);
48+
}
49+
50+
/**
51+
* Convert an authentication exception into an unauthenticated response.
52+
*
53+
* @param \Illuminate\Http\Request $request
54+
* @param \Illuminate\Auth\AuthenticationException $exception
55+
* @return \Illuminate\Http\Response
56+
*/
57+
protected function unauthenticated($request, AuthenticationException $exception)
58+
{
59+
if ($request->expectsJson()) {
60+
return response()->json(['error' => 'Unauthenticated.'], 401);
61+
}
62+
63+
return redirect()->guest(route('auth.login'));
64+
}
65+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Admin;
4+
5+
use Spatie\Permission\Models\Permission;
6+
use Illuminate\Http\Request;
7+
use Illuminate\Support\Facades\Gate;
8+
use App\Http\Controllers\Controller;
9+
use App\Http\Requests\Admin\StorePermissionsRequest;
10+
use App\Http\Requests\Admin\UpdatePermissionsRequest;
11+
12+
class PermissionsController extends Controller
13+
{
14+
/**
15+
* Display a listing of Permission.
16+
*
17+
* @return \Illuminate\Http\Response
18+
*/
19+
public function index()
20+
{
21+
if (! Gate::allows('users_manage')) {
22+
return abort(401);
23+
}
24+
25+
$permissions = Permission::all();
26+
27+
return view('admin.permissions.index', compact('permissions'));
28+
}
29+
30+
/**
31+
* Show the form for creating new Permission.
32+
*
33+
* @return \Illuminate\Http\Response
34+
*/
35+
public function create()
36+
{
37+
if (! Gate::allows('users_manage')) {
38+
return abort(401);
39+
}
40+
return view('admin.permissions.create');
41+
}
42+
43+
/**
44+
* Store a newly created Permission in storage.
45+
*
46+
* @param \App\Http\Requests\StorePermissionsRequest $request
47+
* @return \Illuminate\Http\Response
48+
*/
49+
public function store(StorePermissionsRequest $request)
50+
{
51+
if (! Gate::allows('users_manage')) {
52+
return abort(401);
53+
}
54+
Permission::create($request->all());
55+
56+
return redirect()->route('admin.permissions.index');
57+
}
58+
59+
60+
/**
61+
* Show the form for editing Permission.
62+
*
63+
* @param int $id
64+
* @return \Illuminate\Http\Response
65+
*/
66+
public function edit($id)
67+
{
68+
if (! Gate::allows('users_manage')) {
69+
return abort(401);
70+
}
71+
$permission = Permission::findOrFail($id);
72+
73+
return view('admin.permissions.edit', compact('permission'));
74+
}
75+
76+
/**
77+
* Update Permission in storage.
78+
*
79+
* @param \App\Http\Requests\UpdatePermissionsRequest $request
80+
* @param int $id
81+
* @return \Illuminate\Http\Response
82+
*/
83+
public function update(UpdatePermissionsRequest $request, $id)
84+
{
85+
if (! Gate::allows('users_manage')) {
86+
return abort(401);
87+
}
88+
$permission = Permission::findOrFail($id);
89+
$permission->update($request->all());
90+
91+
return redirect()->route('admin.permissions.index');
92+
}
93+
94+
95+
/**
96+
* Remove Permission from storage.
97+
*
98+
* @param int $id
99+
* @return \Illuminate\Http\Response
100+
*/
101+
public function destroy($id)
102+
{
103+
if (! Gate::allows('users_manage')) {
104+
return abort(401);
105+
}
106+
$permission = Permission::findOrFail($id);
107+
$permission->delete();
108+
109+
return redirect()->route('admin.permissions.index');
110+
}
111+
112+
/**
113+
* Delete all selected Permission at once.
114+
*
115+
* @param Request $request
116+
*/
117+
public function massDestroy(Request $request)
118+
{
119+
if (! Gate::allows('users_manage')) {
120+
return abort(401);
121+
}
122+
if ($request->input('ids')) {
123+
$entries = Permission::whereIn('id', $request->input('ids'))->get();
124+
125+
foreach ($entries as $entry) {
126+
$entry->delete();
127+
}
128+
}
129+
}
130+
131+
}

0 commit comments

Comments
 (0)