Skip to content

Commit

Permalink
Add frontend guard
Browse files Browse the repository at this point in the history
  • Loading branch information
chapdel committed Nov 19, 2020
1 parent cb7ca7a commit 733bc0b
Show file tree
Hide file tree
Showing 9 changed files with 608 additions and 47 deletions.
2 changes: 1 addition & 1 deletion app/Http/Controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class UserController extends Controller
public function index()
{

return Inertia::render('Users/Index', ['users' => User::where('id', '<>', auth()->id())->get()]);
return Inertia::render('Users/Index', ['users' => User::where('id', '<>', auth()->id())->orderBy('created_at', 'desc')->get()]);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@ class User extends Authenticatable

public function lists()
{
return $this->hasMany(Lists:class);
return $this->hasMany(Lists::class);
}
}
9 changes: 8 additions & 1 deletion app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Support\Facades\Schema;
use Illuminate\Support\ServiceProvider;
use Inertia\Inertia;

class AppServiceProvider extends ServiceProvider
{
Expand All @@ -14,7 +15,13 @@ class AppServiceProvider extends ServiceProvider
*/
public function register()
{
//
Inertia::share([
'auth' => function () {
return [
'roles' => auth()->user() ? auth()->user()->roles->pluck('name') : null
];
}
]);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "laravel/laravel",
"name": "chapdel/notchrelay",
"type": "project",
"description": "The Laravel Framework.",
"description": "Free email marketing tool.",
"keywords": [
"framework",
"laravel"
"newsletter",
"email"
],
"license": "MIT",
"require": {
Expand Down
11 changes: 9 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"vue-template-compiler": "^2.6.10"
},
"dependencies": {
"@inertiajs/progress": "^0.2.2",
"moment-timezone": "^0.5.32",
"vue-moment": "^4.1.0",
"vue-tailwind": "^1.3.3"
Expand Down
Loading

0 comments on commit 733bc0b

Please sign in to comment.