From 50bcae442ec5ce031719cd55e329d321d8aead43 Mon Sep 17 00:00:00 2001 From: Arno Kaimbacher Date: Thu, 4 Oct 2018 16:41:29 +0200 Subject: [PATCH] better collection handlich in backend --- .../Controllers/Frontend/HomeController.php | 9 +- .../Settings/CollectionController.php | 32 +++- .../Settings/CollectionRoleController.php | 148 ++++++++++++++++++ .../Requests/Collection/CollectionRequest.php | 34 ++++ app/Http/Requests/PersonRequest.php | 2 +- app/Http/Requests/ProjectRequest.php | 4 +- app/Models/Collection.php | 25 +++ app/Models/CollectionRole.php | 29 ++++ app/Models/Dataset.php | 6 + app/Models/Project.php | 2 +- composer.lock | 42 ++--- public/backend/style.css | 2 +- resources/assets/js/app.js | 1 - .../views/frontend/sitelink/index.blade.php | 30 ++-- .../settings/collection/collection.blade.php | 25 +-- .../views/settings/collection/edit.blade.php | 44 ++++++ .../settings/collectionrole/edit.blade.php | 46 ++++++ .../settings/collectionrole/index.blade.php | 67 ++++++++ .../settings/collectionrole/show.blade.php | 65 ++++++++ .../views/settings/layouts/app.blade.php | 5 +- .../views/settings/person/_form.blade.php | 3 +- .../views/settings/project/_form.blade.php | 5 + routes/breadcrumbs.php | 31 ++++ routes/web.php | 34 +++- 24 files changed, 623 insertions(+), 68 deletions(-) create mode 100644 app/Http/Controllers/Settings/CollectionRoleController.php create mode 100644 app/Http/Requests/Collection/CollectionRequest.php create mode 100644 app/Models/CollectionRole.php create mode 100644 resources/views/settings/collection/edit.blade.php create mode 100644 resources/views/settings/collectionrole/edit.blade.php create mode 100644 resources/views/settings/collectionrole/index.blade.php create mode 100644 resources/views/settings/collectionrole/show.blade.php diff --git a/app/Http/Controllers/Frontend/HomeController.php b/app/Http/Controllers/Frontend/HomeController.php index 43323c4..e649b8f 100644 --- a/app/Http/Controllers/Frontend/HomeController.php +++ b/app/Http/Controllers/Frontend/HomeController.php @@ -92,13 +92,12 @@ class HomeController extends Controller /** * show page by $page_slug. */ - public function showPage($slug) + public function showPage($slug): View { // $result = $pages->findBySlug($slug); - if (!is_null(Page::query()->wherePage_slug($slug)->firstOrFail())) { - $result = Page::query()->wherePage_slug($slug)->firstOrFail(); - return view('frontend.pages.index') - ->withpage($result); + if (!is_null(Page::query()->where('page_slug', $slug)->firstOrFail())) { + $result = Page::query()->where('page_slug', $slug)->firstOrFail(); + return view('frontend.pages.index')->withpage($result); } else { throw new GeneralException(trans('exceptions.backend.access.pages.not_found')); } diff --git a/app/Http/Controllers/Settings/CollectionController.php b/app/Http/Controllers/Settings/CollectionController.php index f842fa0..13a11ce 100644 --- a/app/Http/Controllers/Settings/CollectionController.php +++ b/app/Http/Controllers/Settings/CollectionController.php @@ -5,6 +5,8 @@ use Illuminate\Http\Request; use App\Http\Requests; use App\Http\Controllers\Controller; use App\Models\Collection; +use App\Models\CollectionRole; +use App\Http\Requests\Collection\CollectionRequest; class CollectionController extends Controller { @@ -52,12 +54,17 @@ class CollectionController extends Controller /** * Display the specified resource. * - * @param int $id + * @param Collection $collection * @return \Illuminate\Http\Response */ - public function show($id) + public function show(Collection $collection) { - // + $collection = Collection::findOrFail($collection->id); + //get child collections + $collections = $collection + ->children() + ->paginate(10); + return view('settings.collection.collection', compact('collections')); } /** @@ -68,7 +75,9 @@ class CollectionController extends Controller */ public function edit($id) { - // + $collection = Collection::findOrFail($id); + $collectionroles = CollectionRole::pluck('name', 'id'); + return view('settings.collection.edit', compact('collection', 'collectionroles')); } /** @@ -78,9 +87,20 @@ class CollectionController extends Controller * @param int $id * @return \Illuminate\Http\Response */ - public function update(Request $request, $id) + public function update(CollectionRequest $request, $id) { - // + $collection = Collection::findOrFail($id); + $input = $request->all(); + //$input = $request->except('licenses', 'titles'); + $collection->update($input); + session()->flash('flash_message', 'You have updated the collection "' . $collection->name . '"!'); + if ($collection->parent()->exists()) { + return redirect()->route('settings.collection.show', $collection->parent); + } else { + $test = $collection->collectionrole; + return redirect()->route('settings.collectionrole.show', $collection->collectionrole); + } + //return redirect()->route('settings.collectionrole.index'); } /** diff --git a/app/Http/Controllers/Settings/CollectionRoleController.php b/app/Http/Controllers/Settings/CollectionRoleController.php new file mode 100644 index 0000000..da35945 --- /dev/null +++ b/app/Http/Controllers/Settings/CollectionRoleController.php @@ -0,0 +1,148 @@ +get(); + //$collections = Collection::get(); + $collectionroles = CollectionRole::query() //with('collections') + ->with(['collections' => function ($query) { + $query->whereNull('parent_id'); + }]) + ->get(); + return view('settings.collectionrole.index', compact('collectionroles')); + } + + /** + * Show the form for creating a new resource. + * + * @return \Illuminate\Http\Response + */ + public function create() + { + // + } + + /** + * Store a newly created resource in storage. + * + * @param \Illuminate\Http\Request $request + * @return \Illuminate\Http\Response + */ + public function store(Request $request) + { + // + } + + /** + * Display the specified resource. + * + * @param CollectionRole $collectionrole + * @return \Illuminate\Http\Response + */ + public function show(CollectionRole $collectionrole) + { + $collectionrole = CollectionRole::findOrFail($collectionrole->id); + //$collections = Collection::query() + $collections = $collectionrole + ->collections() + ->whereNull('parent_id') + // ->where('role_id', '=', $id) + ->paginate(10); + return view('settings.collectionrole.show', compact('collections')); + } + + /** + * Show the form for editing the specified resource. + * + * @param int $id + * @return \Illuminate\Http\Response + */ + public function edit($id) + { + $collectionrole = CollectionRole::findOrFail($id); + return view('settings.collectionrole.edit', compact('collectionrole')); + } + + /** + * Update the specified resource in storage. + * + * @param \Illuminate\Http\Request $request + * @param int $id + * @return RedirectResponse + */ + public function update(Request $request, $id): RedirectResponse + { + $project = CollectionRole::findOrFail($id); + $input = $request->all(); + $project->update($input); + session()->flash('flash_message', 'You have updated the collection role!'); + return redirect()->route('settings.collectionrole.index'); + } + + /** + * Remove the specified resource from storage. + * + * @param int $id + * @return \Illuminate\Http\Response + */ + public function delete($id) + { + // + } + + /** + * deactivate author, submitter etc.... + * + * @param int $id + * @return \Illuminate\Http\Response + */ + public function hide($id): RedirectResponse + { + $collectionrole = CollectionRole::findOrFail($id); + $collectionrole->update(['visible' => 0]); + session()->flash( + 'flash_message', + 'Visibility of collection role "' . $collectionrole->name . '" has changed successfully.' + ); + return redirect()->route('settings.collectionrole.index'); + } + + /** + * activatew author, submitter etc.... + * + * @param int $id + * @return \Illuminate\Http\Response + */ + public function up($id): RedirectResponse + { + // $dateNow = time(); + $collectionrole = CollectionRole::findOrFail($id); + $collectionrole->update(['visible' => 1]); + session()->flash( + 'flash_message', + 'Visibility of collection role "' . $collectionrole->name . '" has changed successfully.' + ); + return redirect()->route('settings.collectionrole.index'); + } +} diff --git a/app/Http/Requests/Collection/CollectionRequest.php b/app/Http/Requests/Collection/CollectionRequest.php new file mode 100644 index 0000000..db233d2 --- /dev/null +++ b/app/Http/Requests/Collection/CollectionRequest.php @@ -0,0 +1,34 @@ +allow('edit-page'); + } + + /** + * Get the validation rules that apply to the request. + * + * @return array + */ + public function rules() + { + return [ + 'name' => 'required|max:255', + 'role_id' => 'required', + ]; + } +} diff --git a/app/Http/Requests/PersonRequest.php b/app/Http/Requests/PersonRequest.php index b42a12b..cfb9daf 100644 --- a/app/Http/Requests/PersonRequest.php +++ b/app/Http/Requests/PersonRequest.php @@ -25,7 +25,7 @@ class PersonRequest extends Request return [ 'academic_title' => 'nullable|min:2|max:255', 'last_name' => 'required|min:3|max:255', - 'first_name' => 'nullable|min:3|max:255', + 'first_name' => 'required|min:3|max:255', 'email' => 'nullable|email|max:100', 'identifier_orcid' => 'nullable|min:19|max:50', 'status' => 'required|boolean' diff --git a/app/Http/Requests/ProjectRequest.php b/app/Http/Requests/ProjectRequest.php index 846910a..aa6f6fc 100644 --- a/app/Http/Requests/ProjectRequest.php +++ b/app/Http/Requests/ProjectRequest.php @@ -25,8 +25,8 @@ class ProjectRequest extends Request return [ 'name' => 'required|min:3|max:255', - 'label' => 'required|min:3|max:10' - + 'label' => 'required|min:3|max:10', + 'description' => 'required' ]; } } diff --git a/app/Models/Collection.php b/app/Models/Collection.php index 60edaec..6adf87c 100644 --- a/app/Models/Collection.php +++ b/app/Models/Collection.php @@ -7,9 +7,34 @@ use App\Models\Dataset; class Collection extends Model { + public $timestamps = false; + protected $fillable = [ + 'name', + 'role_id', + ]; public function documents() { return $this->belongsToMany(Dataset::class, 'link_documents_collections', 'collection_id', 'document_id'); } + + #region self join + public function parent() + { + return $this->belongsTo(self::class, 'parent_id'); + } + + public function children() + { + return $this->hasMany(self::class, 'parent_id'); + } + #endregion + + /** + * Get the collection role that the dataset belongs to. + */ + public function collectionrole() + { + return $this->belongsTo(CollectionRole::class, 'role_id', 'id'); + } } diff --git a/app/Models/CollectionRole.php b/app/Models/CollectionRole.php new file mode 100644 index 0000000..0167128 --- /dev/null +++ b/app/Models/CollectionRole.php @@ -0,0 +1,29 @@ +belongsToMany(Dataset::class, 'link_documents_collections', 'role_id', 'document_id'); + // } + + public function collections() + { + //model, foreign key on the Collection model is role_id, local id of this is id + return $this->hasMany(Collection::class, 'role_id', 'id'); + } +} diff --git a/app/Models/Dataset.php b/app/Models/Dataset.php index 42dbb47..700b780 100644 --- a/app/Models/Dataset.php +++ b/app/Models/Dataset.php @@ -62,6 +62,12 @@ class Dataset extends Model ->belongsToMany(Collection::class, 'link_documents_collections', 'document_id', 'collection_id'); } + // public function collectionRoles() + // { + // return $this + // ->belongsToMany(CollectionRole::class, 'link_documents_collections', 'document_id', 'role_id'); + // } + #region [person table] //return all persons attached to this film diff --git a/app/Models/Project.php b/app/Models/Project.php index bfaefa6..6f5d808 100644 --- a/app/Models/Project.php +++ b/app/Models/Project.php @@ -12,7 +12,7 @@ class Project extends Model // for using $input = $request->all(); //$project = Project::create($input); protected $fillable = [ - 'name', 'label' + 'name', 'label', 'description' ]; diff --git a/composer.lock b/composer.lock index 9ac07d1..8d7cb8b 100755 --- a/composer.lock +++ b/composer.lock @@ -854,26 +854,26 @@ }, { "name": "league/flysystem", - "version": "1.0.46", + "version": "1.0.47", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "f3e0d925c18b92cf3ce84ea5cc58d62a1762a2b2" + "reference": "a11e4a75f256bdacf99d20780ce42d3b8272975c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/f3e0d925c18b92cf3ce84ea5cc58d62a1762a2b2", - "reference": "f3e0d925c18b92cf3ce84ea5cc58d62a1762a2b2", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/a11e4a75f256bdacf99d20780ce42d3b8272975c", + "reference": "a11e4a75f256bdacf99d20780ce42d3b8272975c", "shasum": "" }, "require": { + "ext-fileinfo": "*", "php": ">=5.5.9" }, "conflict": { "league/flysystem-sftp": "<1.0.6" }, "require-dev": { - "ext-fileinfo": "*", "phpspec/phpspec": "^3.4", "phpunit/phpunit": "^5.7.10" }, @@ -934,7 +934,7 @@ "sftp", "storage" ], - "time": "2018-08-22T07:45:22+00:00" + "time": "2018-09-14T15:30:29+00:00" }, { "name": "monolog/monolog", @@ -1060,16 +1060,16 @@ }, { "name": "nesbot/carbon", - "version": "1.33.0", + "version": "1.34.0", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "55667c1007a99e82030874b1bb14d24d07108413" + "reference": "1dbd3cb01c5645f3e7deda7aa46ef780d95fcc33" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/55667c1007a99e82030874b1bb14d24d07108413", - "reference": "55667c1007a99e82030874b1bb14d24d07108413", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/1dbd3cb01c5645f3e7deda7aa46ef780d95fcc33", + "reference": "1dbd3cb01c5645f3e7deda7aa46ef780d95fcc33", "shasum": "" }, "require": { @@ -1111,20 +1111,20 @@ "datetime", "time" ], - "time": "2018-08-07T08:39:47+00:00" + "time": "2018-09-20T19:36:25+00:00" }, { "name": "nikic/php-parser", - "version": "v4.0.3", + "version": "v4.0.4", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "bd088dc940a418f09cda079a9b5c7c478890fb8d" + "reference": "fa6ee28600d21d49b2b4e1006b48426cec8e579c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/bd088dc940a418f09cda079a9b5c7c478890fb8d", - "reference": "bd088dc940a418f09cda079a9b5c7c478890fb8d", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/fa6ee28600d21d49b2b4e1006b48426cec8e579c", + "reference": "fa6ee28600d21d49b2b4e1006b48426cec8e579c", "shasum": "" }, "require": { @@ -1162,7 +1162,7 @@ "parser", "php" ], - "time": "2018-07-15T17:25:16+00:00" + "time": "2018-09-18T07:03:24+00:00" }, { "name": "paragonie/random_compat", @@ -4169,16 +4169,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.3.1", + "version": "3.3.2", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "628a481780561150481a9ec74709092b9759b3ec" + "reference": "6ad28354c04b364c3c71a34e4a18b629cc3b231e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/628a481780561150481a9ec74709092b9759b3ec", - "reference": "628a481780561150481a9ec74709092b9759b3ec", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/6ad28354c04b364c3c71a34e4a18b629cc3b231e", + "reference": "6ad28354c04b364c3c71a34e4a18b629cc3b231e", "shasum": "" }, "require": { @@ -4216,7 +4216,7 @@ "phpcs", "standards" ], - "time": "2018-07-26T23:47:18+00:00" + "time": "2018-09-23T23:08:17+00:00" }, { "name": "theseer/tokenizer", diff --git a/public/backend/style.css b/public/backend/style.css index 0fe45d5..5fafcaa 100644 --- a/public/backend/style.css +++ b/public/backend/style.css @@ -475,7 +475,7 @@ a:hover { text-decoration: none; }*/ /*table { width: 100%; margin: 2em 0; }*/ .pure-table a { color: #333; - text-decoration: none; + text-decoration:underline; } .pure-table a:hover { diff --git a/resources/assets/js/app.js b/resources/assets/js/app.js index fd7826b..853155d 100644 --- a/resources/assets/js/app.js +++ b/resources/assets/js/app.js @@ -17,7 +17,6 @@ window.Vue = require('vue'); Vue.component('my-vuetable', require('./components/MyVuetable.vue')); - const app = new Vue({ el: '#app' }); \ No newline at end of file diff --git a/resources/views/frontend/sitelink/index.blade.php b/resources/views/frontend/sitelink/index.blade.php index 1cdd62d..6529430 100644 --- a/resources/views/frontend/sitelink/index.blade.php +++ b/resources/views/frontend/sitelink/index.blade.php @@ -1,5 +1,4 @@ -@extends('layouts.app') - +@extends('layouts.app') @section('content')
@@ -13,9 +12,9 @@ -
-
    +
      +
    1. @@ -24,27 +23,28 @@
      -
      server_date_published->toDayDateTimeString() ?> +
      + server_date_published->toDayDateTimeString() ?>
      @foreach ($document->authors as $author) - Author: {{ $author->getFullName() }} -
      - @endforeach - + Author: {{ $author->full_name }} +
      + @endforeach @foreach ($document->titles as $title) Main Title: {{ $title->value }} -
      +
      @endforeach
      -
    2. + +
- -
-
+ + + -@endsection +@endsection \ No newline at end of file diff --git a/resources/views/settings/collection/collection.blade.php b/resources/views/settings/collection/collection.blade.php index dff0126..26fe2f3 100644 --- a/resources/views/settings/collection/collection.blade.php +++ b/resources/views/settings/collection/collection.blade.php @@ -11,16 +11,16 @@
- - ADD NEW COLLECTION + + ADD NEW CHILD COLLECTION

- - + + @@ -30,8 +30,13 @@ @foreach($collections as $collection) - - + + diff --git a/resources/views/settings/collection/edit.blade.php b/resources/views/settings/collection/edit.blade.php new file mode 100644 index 0000000..01a1bea --- /dev/null +++ b/resources/views/settings/collection/edit.blade.php @@ -0,0 +1,44 @@ +@extends('settings.layouts.app') +@section('content') +
+

+ Edit Collection "{{ $collection->name }}" +

+
+ +
+ @if($collection->parent()->exists()) + + + BACK + + @else + + + BACK + + @endif + +
+ {!! Form::model($collection, ['method' => 'PATCH', 'route' => ['settings.collection.update', $collection->id], 'class' => + 'pure-form pure-form-aligned']) !!} +
+
+ {{ Form::label('name', 'collection name') }} {{ Form::text('name', null, ['class' => 'form-control']) }} + * +
+ +
+ {!! Form::label('role_id', 'Collection Role..') !!} + {!! Form::select('role_id', $collectionroles, null, ['id' => 'role_id', 'placeholder' => '-- no role selected --']) !!} + + * +
+ + {{ Form::submit("Submit", ['class' => 'pure-button button-small']) }} +
+ @include('errors._errors') + {!! Form::close() !!} +
+
+@endsection \ No newline at end of file diff --git a/resources/views/settings/collectionrole/edit.blade.php b/resources/views/settings/collectionrole/edit.blade.php new file mode 100644 index 0000000..2fb7174 --- /dev/null +++ b/resources/views/settings/collectionrole/edit.blade.php @@ -0,0 +1,46 @@ +@extends('settings.layouts.app') + +@section('content') +
+

+ Edit Collection Role +

+
+ +
+ + + BACK + +
+ {!! Form::model($collectionrole, ['method' => 'PATCH', 'route' => ['settings.collectionrole.update', $collectionrole->id], 'class' => 'pure-form pure-form-aligned']) !!} +
+ +
+ {{ Form::label('name', 'collectionrole name') }} + {{ Form::text('name', null, ['class' => 'form-control']) }} + * +
+
+ {{ Form::label('oai_name', 'name of oai set') }} + {{ Form::text('oai_name', null, ['class' => 'form-control']) }} + * +
+ + + + + {{ Form::submit("Submit", ['class' => 'pure-button button-small']) }} +
+ {!! Form::close() !!} +
+
+@endsection \ No newline at end of file diff --git a/resources/views/settings/collectionrole/index.blade.php b/resources/views/settings/collectionrole/index.blade.php new file mode 100644 index 0000000..390ea78 --- /dev/null +++ b/resources/views/settings/collectionrole/index.blade.php @@ -0,0 +1,67 @@ +@extends('settings.layouts.app') +@section('content') +
+

+ Collection Roles +

+
+ + +
+ +
CollectionidCollection (number of child collections)Collection Role Document id's Options
{{ $collection->name }}{{ $collection->id }} + + {{-- {{ $collection->name }} --}} + {{ $collection->name .' ('. $collection->children->count() .')' }} + + {{ $collection->collectionrole->name }} @foreach ($collection->documents as $document)

document id: {{ $document->id }}

@@ -39,12 +44,8 @@
- - - - - - + + {{-- --}}
+ + + + + + + + + + @foreach($collectionroles as $collectionrole) + + + + + + + @endforeach + + +
CollectionCount Of Nested CollectionsOptionsVisible
+ + {{ $collectionrole->name .' ('. $collectionrole->collections->count() .')' }} + + + {{-- @foreach ($collection->documents as $document) +

document id: {{ $document->id }}

+ @endforeach --}} + {{ $collectionrole->collections->count() }} + {{-- Show Collections --}} + +
+ + {{-- --}} + + @if($collectionrole->visible == 1) + Hide + @else + Unhide + @endif +
+
+ +
+ {{-- {{ $collectionroles->links('vendor.pagination.default') }} --}} +
+ +
+ +@stop \ No newline at end of file diff --git a/resources/views/settings/collectionrole/show.blade.php b/resources/views/settings/collectionrole/show.blade.php new file mode 100644 index 0000000..6feef15 --- /dev/null +++ b/resources/views/settings/collectionrole/show.blade.php @@ -0,0 +1,65 @@ +@extends('settings.layouts.app') + +@section('content') +
+

+ Top Level Collections +

+
+ + +
+ +
+ {{-- + ADD NEW COLLECTION + --}} +

+ + + + + + + + + + + + + @foreach($collections as $collection) + + + + + + + + + + @endforeach + + + +
Collection (number of child collections)Collection RoleDocument id'sOptions
+ + {{-- {{ $collection->name }} --}} + {{ $collection->name .' ('. $collection->children->count() .')' }} + + {{ $collection->collectionrole->name }} + @foreach ($collection->documents as $document) +

document id: {{ $document->id }}

+ @endforeach + +
+ + {{-- --}} +
+
+ +
+ {{ $collections->links('vendor.pagination.default') }} +
+ +
+@stop \ No newline at end of file diff --git a/resources/views/settings/layouts/app.blade.php b/resources/views/settings/layouts/app.blade.php index 79c0bfe..724d42b 100644 --- a/resources/views/settings/layouts/app.blade.php +++ b/resources/views/settings/layouts/app.blade.php @@ -53,8 +53,11 @@
  • Datasets
  • -
  • + {{--
  • Collections +
  • --}} +
  • + Collection Roles
  • Licenses diff --git a/resources/views/settings/person/_form.blade.php b/resources/views/settings/person/_form.blade.php index f339a46..f031fc4 100644 --- a/resources/views/settings/person/_form.blade.php +++ b/resources/views/settings/person/_form.blade.php @@ -14,7 +14,8 @@
    {!! Form::label('first_name', 'First Name..') !!} {!! Form::text('first_name', null, ['class' => 'form-control']) !!} - + * + {{-- --}}
    diff --git a/resources/views/settings/project/_form.blade.php b/resources/views/settings/project/_form.blade.php index 4b92eba..265c4d4 100644 --- a/resources/views/settings/project/_form.blade.php +++ b/resources/views/settings/project/_form.blade.php @@ -9,6 +9,11 @@ {{ Form::text('label', null, ['class' => 'form-control']) }} * +
    + {{ Form::label('description', 'description') }} + {{ Form::textarea('description', null, ['class' => 'form-control', 'size' => '70x6']) }} + * +
    {{ Form::submit($submitButtonText, ['class' => 'pure-button button-small']) }} diff --git a/routes/breadcrumbs.php b/routes/breadcrumbs.php index dddc37a..019bfa1 100644 --- a/routes/breadcrumbs.php +++ b/routes/breadcrumbs.php @@ -56,3 +56,34 @@ Breadcrumbs::register('settings.page.index', function ($breadcrumbs) { $breadcrumbs->parent('settings.dashboard'); $breadcrumbs->push('Page Management', route('settings.page.index')); }); + + +Breadcrumbs::register('settings.collectionrole.index', function ($breadcrumbs) { + $breadcrumbs->parent('settings.dashboard'); + $breadcrumbs->push('Collection Roles', route('settings.collectionrole.index')); +}); +Breadcrumbs::register('settings.collectionrole.show', function ($breadcrumbs, $collectionrole) { + $breadcrumbs->parent('settings.collectionrole.index'); + $breadcrumbs->push( + 'top level collections of role ' . $collectionrole->name, + route('settings.collectionrole.show', $collectionrole) + ); +}); +Breadcrumbs::register('settings.collection.show', function ($breadcrumbs, $collection) { + // $breadcrumbs->parent('settings.collectionrole.show', $collection->collectionrole); + if ($collection->parent()->exists()) { + $breadcrumbs->parent('settings.collection.show', $collection->parent); + } else { + $breadcrumbs->parent('settings.collectionrole.show', $collection->collectionrole); + } + $breadcrumbs->push('show collection: ' . $collection->name, route('settings.collection.show', $collection)); +}); +Breadcrumbs::register('settings.collection.edit', function ($breadcrumbs, $id) { + $collection = App\Models\Collection::findOrFail($id); + if ($collection->parent()->exists()) { + $breadcrumbs->parent('settings.collection.show', $collection->parent); + } else { + $breadcrumbs->parent('settings.collectionrole.show', $collection->collectionrole); + } + $breadcrumbs->push('edit collection: ' . $collection->name, route('settings.collection.edit', $id)); +}); diff --git a/routes/web.php b/routes/web.php index 543ecc0..9f92d3b 100644 --- a/routes/web.php +++ b/routes/web.php @@ -121,17 +121,49 @@ Route::group(['middleware' => ['permission:settings']], function () { ]); //=================================================setting collection============================================= Route::get('/settings/collection', [ - 'as' => 'settings.collection', 'uses' => 'Settings\CollectionController@index', + 'as' => 'settings.collection.index', 'uses' => 'Settings\CollectionController@index', ]); + + Route::get('/settings/collection/create', [ + 'as' => 'settings.collection.create', 'uses' => 'Settings\CollectionController@create', + ]); + Route::post('settings/collection/store', [ + 'as' => 'settings.collection.store', 'uses' => 'Settings\CollectionController@store', + ]); + Route::get('settings/collection/edit/{id}', [ 'as' => 'settings.collection.edit', 'uses' => 'Settings\CollectionController@edit', ]); Route::patch('settings/collection/edit/{id}', [ 'as' => 'settings.collection.update', 'uses' => 'Settings\CollectionController@update', ]); + Route::get('settings/collection/show/{collection}', [ + 'as' => 'settings.collection.show', 'uses' => 'Settings\CollectionController@show', + ]); Route::get('settings/collection/delete/{id}', [ 'as' => 'settings.collection.delete', 'uses' => 'Settings\CollectionController@delete', ]); + //=================================================setting collection_role========================================= + Route::get('/settings/collectionrole', [ + 'as' => 'settings.collectionrole.index', 'uses' => 'Settings\CollectionRoleController@index', + ]); + + Route::get('settings/collectionrole/edit/{id}', [ + 'as' => 'settings.collectionrole.edit', 'uses' => 'Settings\CollectionRoleController@edit', + ]); + Route::patch('settings/collectionrole/update/{id}', [ + 'as' => 'settings.collectionrole.update', 'uses' => 'Settings\CollectionRoleController@update', + ]); + Route::get('settings/collectionrole/show/{collectionrole}', [ + 'as' => 'settings.collectionrole.show', 'uses' => 'Settings\CollectionRoleController@show', + ]); + Route::get('settings/collectionrole/hide/{id}', [ + 'as' => 'settings.collectionrole.hide', 'uses' => 'Settings\CollectionRoleController@hide', + ]); + Route::get('settings/collectionrole/up/{id}', [ + 'as' => 'settings.collectionrole.up', 'uses' => 'Settings\CollectionRoleController@up', + ]); + //================================================================================================================== //=================================================setting project================================================== Route::get('/settings/project', [