File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change 1212 config ('jetstream.auth_session ' ),
1313 'verified ' ,
1414])->group (function () {
15- /*Route::get('/dashboard', function () {
16- return view('dashboard');
17- })->name('dashboard');*/
1815 Route::redirect ('/dashboard ' , '/app ' )->name ('dashboard ' );
1916});
20- //asset_id
17+
2118Route::get ('/a/{asset_id} ' , function (string $ asset_id ) {
22- $ asset = \App \Models \Item::where ('asset_id ' , $ asset_id )->first ();
19+ $ team_id = auth ()?->user()?->currentTeam()?->getChild()?->id;
20+ // todo: put this logic in one place
21+ $ asset_id = ltrim ($ asset_id , '0 ' );
22+ $ asset_id = ltrim ($ asset_id , '- ' );
23+
24+ $ asset = \App \Models \Item::where ('asset_id ' , $ asset_id )
25+ ->where ('team_id ' , $ team_id )
26+ ->first ();
2327 if (! $ asset ) {
2428 // create new empty one with this asset id
2529 $ asset = new \App \Models \Item ();
2630 $ asset ->asset_id = $ asset_id ;
27- $ asset ->team_id = auth ()?->user()?->currentTeam()?->getChild()?->id ;
31+ $ asset ->team_id = $ team_id ;
2832 $ asset ->save ();
2933 }
3034
31- return redirect ()->to (ItemResource::getUrl ('edit ' , ['record ' => $ asset ]));
35+ return redirect ()->to (ItemResource::getUrl ('edit ' , ['record ' => $ asset, ' tenant ' => $ team_id ]));
3236})->name ('asset ' );
You can’t perform that action at this time.
0 commit comments