Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Command and Mails, Update Readme #10

Merged
merged 1 commit into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

[![Latest Kompass Version](https://img.shields.io/packagist/v/secondnetwork/kompass.svg?style=for-the-badge&label=Kompass&labelColor=FFA700&color=1A2A2C)](https://github.com/secondnetwork/kompass)
[![Laravel](https://img.shields.io/badge/v10.X-999999?style=for-the-badge&label=Laravel&labelColor=eb4432&color=1A2A2C)](https://laravel.com)
[![PHP 8.1](https://img.shields.io/badge/v8.2-999999?style=for-the-badge&label=PHP&labelColor=777BB4&color=1A2A2C)](https://php.com)
[![PHP 8.1](https://img.shields.io/badge/v8.1-999999?style=for-the-badge&label=PHP&labelColor=777BB4&color=1A2A2C)](https://php.com)
[![License](https://img.shields.io/github/license/secondnetwork/kompass?style=for-the-badge)](https://github.com/secondnetwork/kompass)

## The development of Kompass
Expand All @@ -21,11 +21,11 @@ But built with the power of Tailwind, Alpine.js, Laravel and Livewire.
## Requirements

Additionally Kompass requires you to use
- PHP 8.2 or newer
- PHP 8.1 or newer
- Laravel 10.0 or newer
- Laravel Fortify 1.16 or newer
- Livewire 3.0 or newer
- Tailwindcss 3.4 or newer
- Tailwindcss 3.3 or newer

## Installation

Expand Down
18 changes: 0 additions & 18 deletions app/Providers/KompassServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,5 @@ public function boot()
Fortify::twoFactorChallengeView(function () {
return view('auth.two-factor-challenge');
});

$roles = Role::with('users')->get();

$permissionsArray = [];
foreach ($roles as $role) {
$permissionsArray[$role->slug][] = $role->id;
// foreach ($role->slug as $permissions) {
// $permissionsArray[$permissions->title][] = $role->id;
// }
}

// Every permission may have multiple roles assigned
foreach ($permissionsArray as $title => $roles) {
Gate::define($title, function ($user) use ($roles) {
// We check if we have the needed roles among current user's roles
return count(array_intersect($user->roles->pluck('id')->toArray(), $roles)) > 0;
});
}
}
}
3 changes: 3 additions & 0 deletions resources/lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@
"Create API Token": "API-Token erstellen",
"Create Account": "Neues Konto registrieren",
"Create New Team": "Neues Team erstellen",
"Create Password": "Passwort erstellen",
"Create Team": "Team erstellen",
"Create a new team to collaborate with others on projects.": "Erstellen Sie ein neues Team, um mit anderen an Projekten zusammenzuarbeiten.",
"Created.": "Erstellt.",
Expand All @@ -171,6 +172,7 @@
"Delete Selected": "Delete Selected",
"Delete Team": "Team löschen",
"Denmark": "Denmark",
"Description": "Beschreibung",
"Detach": "Detach",
"Detach Resource": "Detach Resource",
"Detach Selected": "Detach Selected",
Expand Down Expand Up @@ -278,6 +280,7 @@
"India": "India",
"Indonesia": "Indonesia",
"Invalid signature.": "Ungültige Signatur.",
"Invitation to access of": "Einladung zum Zugriff auf",
"Iran, Islamic Republic Of": "Iran",
"Iraq": "Iraq",
"Ireland": "Ireland",
Expand Down
1 change: 1 addition & 0 deletions resources/lang/de/kompass.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@
'Team Settings' => 'ST',
'Forgot your password?' => 'PAASSSSjdagjkb',
'failed' => 'Diese Kombination aus Zugangsdaten wurde nicht in unserer Datenbank gefunden.',
'Invitation to access website' =>'Einladung zum Zugriff von Webseite'
];
8 changes: 6 additions & 2 deletions resources/views/livewire/roles.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
@endif
<label>Role Name</label>
<input wire:model="display_name" type="text" class="form-control"/>
<label>{{ __('description') }}</label>

<label>{{ __('Description') }}</label>

<textarea wire:model="description" id="" cols="30" rows="10"></textarea>


Expand All @@ -46,7 +48,9 @@
@endif
<label>Role Name</label>
<input wire:model="display_name" type="text" class="form-control"/>
<label>{{ __('description') }}</label>

<label>{{ __('Description') }}</label>

<textarea wire:model="description" id="" cols="30" rows="10"></textarea>


Expand Down
2 changes: 1 addition & 1 deletion resources/views/mail/invitation.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

# {{__('Hello')}} 👋 {{ $datamessage['name'] ?? ''}},

**{{__('you have been granted access to Kompass admin panel')}}.**
**{{__('Invitation to access of').' '.env('APP_NAME')}}.**

{{__('With your email')}}: **{{ $datamessage['email'] ?? ''}}**

Expand Down
42 changes: 23 additions & 19 deletions src/Commands/KompassCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

use function Laravel\Prompts\info;
use function Laravel\Prompts\note;
use function Laravel\Prompts\warning;
use function Laravel\Prompts\password;
use function Laravel\Prompts\select;
use function Laravel\Prompts\text;
Expand Down Expand Up @@ -79,14 +80,14 @@ protected function sendSuccessMessage(): void
{
$loginUrl = env('APP_URL').'/login';
note('Kompass is now installed.');
info("Logging into your Application at {$loginUrl} with you credentials");
info("Logging at {$loginUrl} with you credentials.");
}

public function handle(): int
{
$this->options = $this->options();

info('Welcome to the installation of Kompass A Laravel CMS');
info('Welcome to the installation of Kompass A Laravel CMS.');

$publishAssets = select(
label: 'Install Frontend Themen?',
Expand All @@ -110,7 +111,7 @@ public function handle(): int
}

$this->publishAssets();

warning('Warning: Have you made a backup of you database?');
$database = select(
label: 'Drop all tables from the database? For a new installation of Kompass!',
options: [
Expand All @@ -121,23 +122,26 @@ public function handle(): int

if ($database) {
$this->databaserun();
$this->createUser();
} else {
$addNewUser = select(
label: 'Create new Admin User?',
options: [
true => 'Yes',
false => 'no',
]
);
}

if ($addNewUser) {
$this->createUser();
}
$addNewUser = select(
label: 'Create new Admin User?',
options: [
true => 'Yes',
false => 'no',
]
);

if ($addNewUser) {
$this->createUser();
}

Artisan::call('optimize:clear');
Artisan::call('storage:link');
$this->call('optimize:clear');

$linkPath = public_path('storage');
if (!file_exists($linkPath)) {
$this->call('storage:link');
}
$this->sendSuccessMessage();

return static::SUCCESS;
Expand Down Expand Up @@ -227,8 +231,8 @@ public function databaserun()
{
// Database seeders...
(new Filesystem)->copyDirectory(__DIR__.'/../database/seeders', 'database/seeders');
Artisan::call('migrate:fresh');
Artisan::call('db:seed');
$this->call('migrate:fresh');
$this->call('db:seed');
$this->info('migrate Database and seed data ...');
}

Expand Down
3 changes: 2 additions & 1 deletion src/Mail/Invitation.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Support\Facades\Lang;
use Illuminate\Queue\SerializesModels;

class Invitation extends Mailable
Expand All @@ -30,6 +31,6 @@ public function __construct($maildata)
*/
public function build()
{
return $this->markdown('kompass::mail.invitation');
return $this->markdown('kompass::mail.invitation')->subject(Lang::get('Invitation to access of').' '.env('APP_NAME'));
}
}
12 changes: 6 additions & 6 deletions stubs/app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable implements MustVerifyEmail
class User extends Authenticatable
{
// use HasApiTokens;
use HasFactory;
Expand Down Expand Up @@ -45,11 +45,11 @@ class User extends Authenticatable implements MustVerifyEmail
'two_factor_secret',
];

/*
protected $casts = [
'email_verified_at' => 'datetime',
];
*/

protected $casts = [
'email_verified_at' => 'datetime',
];


public static function search($search)
{
Expand Down
Loading