publish datasets with authors
This commit is contained in:
parent
ccff83fa66
commit
fde8f76b7c
19 changed files with 451 additions and 324 deletions
|
@ -26,7 +26,11 @@ class IndexController extends Controller
|
|||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
$builder = Dataset::query();
|
||||
$datasets = $builder
|
||||
->where('server_state', 'inprogress')
|
||||
->get();
|
||||
return view('publish.index', compact('datasets'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -43,11 +47,11 @@ class IndexController extends Controller
|
|||
->pluck('part2_t', 'part2_t');
|
||||
// ->toArray();
|
||||
|
||||
$persons = Person::where('status', 1)
|
||||
->pluck('last_name', 'id');
|
||||
// $persons = Person::where('status', 1)
|
||||
// ->pluck('last_name', 'id');
|
||||
$projects = Project::pluck('label', 'id');
|
||||
|
||||
return view('publish.create-step1', compact('licenses', 'languages', 'persons', 'projects'));
|
||||
return view('publish.create-step1', compact('licenses', 'languages', 'projects'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -274,6 +278,15 @@ class IndexController extends Controller
|
|||
$licenses = $request->input('licenses');
|
||||
$dataset->licenses()->sync($licenses);
|
||||
|
||||
//store authors
|
||||
$data_to_sync = [];
|
||||
foreach ($request->get('authors') as $key => $person_id) {
|
||||
$pivot_data = ['role' => 'author', 'sort_order' => $key + 1];
|
||||
// if ($galery_id == $request->get('mainPicture')) $pivot_data = ['main' => 1];
|
||||
$data_to_sync[$person_id] = $pivot_data;
|
||||
}
|
||||
$dataset->persons()->sync($data_to_sync);
|
||||
|
||||
//save main title:
|
||||
if (isset($data['title_main'])) {
|
||||
$formTitle = $request->input('title_main');
|
||||
|
|
|
@ -58,8 +58,8 @@ class RoleController extends Controller
|
|||
}
|
||||
|
||||
return redirect()
|
||||
->route('access.role.index')
|
||||
->with('success', 'Role has been created successfully');
|
||||
->route('access.role.index')
|
||||
->with('success', 'Role has been created successfully');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -26,8 +26,8 @@ class UserController extends Controller
|
|||
//}
|
||||
|
||||
$users = User::with('roles')
|
||||
->orderBy('id', 'DESC')
|
||||
->paginate(5);
|
||||
->orderBy('id', 'DESC')
|
||||
->paginate(5);
|
||||
return view('settings.access.user.user', compact('users'))
|
||||
->with('i', ($request->input('page', 1) - 1) * 5);
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ use Illuminate\View\View;
|
|||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\File;
|
||||
|
||||
class DatasetController extends Controller
|
||||
{
|
||||
|
|
|
@ -73,8 +73,9 @@ class Dataset extends Model
|
|||
//return all persons attached to this film
|
||||
public function persons()
|
||||
{
|
||||
return $this->belongsToMany(Person::class, 'link_documents_persons', 'document_id', 'person_id')
|
||||
->withPivot('role');
|
||||
return $this
|
||||
->belongsToMany(Person::class, 'link_documents_persons', 'document_id', 'person_id')
|
||||
->withPivot('role', 'sort_order', 'allow_email_contact');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue