Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeFourkas authored and github-actions[bot] committed Sep 19, 2023
1 parent 68a9bd8 commit 087ff88
Show file tree
Hide file tree
Showing 12 changed files with 103 additions and 117 deletions.
157 changes: 77 additions & 80 deletions src/Commands/AdminifyCommand.php

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions stubs/app/Http/Controllers/PostController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Http\Controllers\Admin\Adminify;

use App\Http\Controllers\Controller;
use App\Http\Requests\Admin\Adminify\Post\CreatePostModelRequest;
use App\Http\Requests\Admin\Adminify\Post\DeletePostRequest;
use App\Http\Requests\Admin\Adminify\Post\UpdatePostModelRequest;
Expand All @@ -13,11 +14,10 @@
use App\Traits\ReplaceSameFilesWithUniqueIds;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class PostController extends Controller
{
use Multilingual, ReplaceSameFilesWithUniqueIds, FileUploadOrSync;
use FileUploadOrSync, Multilingual, ReplaceSameFilesWithUniqueIds;

public function create()
{
Expand Down Expand Up @@ -94,8 +94,8 @@ public function delete(DeletePostRequest $request, Post $post)
public function search(Request $request)
{
return view('admin.posts.index', [
'posts' => Post::whereTranslationLike('title', '%' . $request->search . '%', App::getLocale())
->orWhereTranslationLike('body', '%' . $request->search . '%', App::getLocale())
'posts' => Post::whereTranslationLike('title', '%'.$request->search.'%', App::getLocale())
->orWhereTranslationLike('body', '%'.$request->search.'%', App::getLocale())
->paginate(15),
]);
}
Expand Down
9 changes: 5 additions & 4 deletions stubs/app/Http/Requests/Post/CreatePostModelRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ public function authorize(): bool
public function rules(): array
{
$defaultLocale = $this->getStore()->get('default_locale');

return [
$defaultLocale . '.title' => 'required',
$defaultLocale . '.body' => 'required',
$defaultLocale.'.title' => 'required',
$defaultLocale.'.body' => 'required',

'featured_image_url' => 'required',
];
Expand All @@ -31,8 +32,8 @@ public function attributes(): array
$defaultLocale = $this->getStore()->get('default_locale');

return [
$defaultLocale . '.title' => __('adminify.post_title'),
$defaultLocale . '.body' =>__('adminify.post_body'),
$defaultLocale.'.title' => __('adminify.post_title'),
$defaultLocale.'.body' => __('adminify.post_body'),
];
}
}
9 changes: 4 additions & 5 deletions stubs/app/Http/Requests/Post/UpdatePostModelRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

class UpdatePostModelRequest extends FormRequest
{

use Multilingual;

/**
Expand All @@ -28,8 +27,8 @@ public function rules(): array
$defaultLocale = $this->getStore()->get('default_locale');

return [
$defaultLocale . '.title' => 'required',
$defaultLocale . '.body' => 'required',
$defaultLocale.'.title' => 'required',
$defaultLocale.'.body' => 'required',
];
}

Expand All @@ -38,8 +37,8 @@ public function attributes(): array
$defaultLocale = $this->getStore()->get('default_locale');

return [
$defaultLocale . '.title' => __('adminify.post_title'),
$defaultLocale . '.body' => __('adminify.post_body'),
$defaultLocale.'.title' => __('adminify.post_title'),
$defaultLocale.'.body' => __('adminify.post_body'),
];
}
}
2 changes: 1 addition & 1 deletion stubs/app/Models/Adminify/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

class Post extends Model implements TranslatableContract
{
use Translatable, HasFactory, HasCategories, HasTags, HasMedia;
use HasCategories, HasFactory, HasMedia, HasTags, Translatable;

protected $guard_name = 'web';

Expand Down
5 changes: 1 addition & 4 deletions stubs/app/Models/Adminify/PostTranslation.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,13 @@ public function sluggable(): array
{
return [
'slug' => [
'source' => 'slug'
'source' => 'slug',
],
];
}


public function getSlugAttribute(): string
{
return is_null($this->title) ? str()->random(10) : $this->title;
}


}
2 changes: 1 addition & 1 deletion stubs/app/Providers/RouteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function boot(): void
->prefix('api')
->group(base_path('routes/api.php'));

Route::localized(function (){
Route::localized(function () {
Route::middleware('web')
->group(base_path('routes/web.php'));
});
Expand Down
4 changes: 0 additions & 4 deletions stubs/app/Rules/FileOrString.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,4 @@ public function message(): string
{
return __('Must be File or Already uploaded file');
}


}


12 changes: 5 additions & 7 deletions stubs/app/Services/Language/AddLanguageService.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ public function addTheLanguage(): static

public function exportLanguageFiles(): static
{
if (!file_exists(lang_path($this->language . '.json'))) {
Artisan::call('translatable:export ' . $this->language);
if (! file_exists(lang_path($this->language.'.json'))) {
Artisan::call('translatable:export '.$this->language);
}

if (!file_exists(lang_path($this->language))) {
if (! file_exists(lang_path($this->language))) {
try {
Artisan::call('lang:add ' . $this->language);
Artisan::call('lang:add '.$this->language);
} catch (UnknownLocaleCodeException $e) {
(new Filesystem())->copyDirectory(
lang_path($this->getStore()->get('default_locale')), lang_path($this->language));
Expand All @@ -67,8 +67,6 @@ public function redirect(): RedirectResponse
{
return
$this->redirectLanguageChange()
->with('success', Locale::getDisplayLanguage($this->language) . __('successfully added to translations list'));
->with('success', Locale::getDisplayLanguage($this->language).__('successfully added to translations list'));
}


}
6 changes: 2 additions & 4 deletions stubs/app/Services/PostService.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class PostService
{
use Multilingual, ReplaceSameFilesWithUniqueIds, FileUploadOrSync;
use FileUploadOrSync, Multilingual, ReplaceSameFilesWithUniqueIds;

private Request $request;

Expand All @@ -22,13 +22,11 @@ class PostService

private array|Collection $data;


public function setRequest(Request $request): static
{
$this->request = $request;
$this->data = collect($this->request->all());


return $this;
}

Expand Down Expand Up @@ -96,7 +94,7 @@ public function updateMedia(): static

$this->post->media()->sync($this->request->featured_image_url);

} else if ($this->request->featured_image_url && $this->request->featured_image_url instanceof UploadedFile){
} elseif ($this->request->featured_image_url && $this->request->featured_image_url instanceof UploadedFile) {

$this->post->media()->sync($this->post->createMediaModel($this->request->featured_image_url, 'public/posts')->id);

Expand Down
2 changes: 1 addition & 1 deletion stubs/app/Traits/HasNullRequestValues.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ trait HasNullRequestValues
{
use Multilingual;

public function removeNullLanguageRequestIndex(array $data): array|null
public function removeNullLanguageRequestIndex(array $data): ?array
{
return collect($data)
->filter(function ($item, $key) {
Expand Down
4 changes: 2 additions & 2 deletions stubs/config/localized-routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
'supported_locales' => array_keys(collect(Valuestore::make(storage_path('app/settings/settings.json'))->get('locales'))
->reject(function ($item) {
return !in_array('published', $item);
return ! in_array('published', $item);
})
->map(function ($item, $key) {
return $key;
Expand Down Expand Up @@ -100,7 +100,7 @@
* as the app locale, regardless if it's a supported locale or not.
*/
'trusted_detectors' => [
CodeZero\LocalizedRoutes\Middleware\Detectors\RouteActionDetector::class //=> required for scoped config
CodeZero\LocalizedRoutes\Middleware\Detectors\RouteActionDetector::class, //=> required for scoped config
],

/**
Expand Down

0 comments on commit 087ff88

Please sign in to comment.