Page not found all I get when trying to get these pages.
web.php looks like this
Route::resource('admin/roles', 'RoleController');
route:list look like this
| GET|HEAD | admin/roles | index | App\Http\Controllers\RoleController#index
| GET|HEAD | admin/roles/create | create | App\Http\Controllers\RoleController#create
| PUT|PATCH | admin/roles/{} | update | App\Http\Controllers\RoleController#update
| GET|HEAD | admin/roles/{} | show | App\Http\Controllers\RoleController#show
| DELETE | admin/roles/{} | destroy | App\Http\Controllers\RoleController#destroy
| GET|HEAD | admin/roles/{}/edit | edit | App\Http\Controllers\RoleController#edit
Controllerlook like this
public function show($id)
{
$role = Role::find($id);
return view('admin.roles/show')->with('role',$role);
}
public function edit($id)
{
$role = Role::find($id);
return view('admin.roles.edit')->with('role',$role);
}
You should try navigating your browser to admin/roles/1 instead of admin/roles/show/1. The route you've tried doesn't exist so you're correctly getting a 404 error.
Since the create and index page work fine, but not show I think there is something up with the route bindings.
Since the routes in route:list command show admin/roles/{}, it makes me think laravel couldn't figure out the bindings.
My best guess for this it to check the http kernel. You should have the \Illuminate\Routing\Middleware\SubstituteBindings::class middleware either in the $middleware array or inside the web group under the $middlewareGroups array. I suggest putting it in the web middleware group.
eg:
protected $middlewareGroups = [
//
'web' => [
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
//
];
Another suggestion:
Try defining the routes individually instead of using Route::resource()
Route::get('admin/roles', 'RoleController#index');
Route::get('admin/roles/create', 'RoleController#create');
Route::patch('admin/roles/{role}', 'RoleController#update');
Route::get('admin/roles/{role}', 'RoleController#show');
Route::delete('admin/roles/{role}', 'RoleController#delete');
Route::get('admin/roles/{role}/edit', 'RoleController#edit');
Note you may need to add ->name('some-name') to fix the names
Related
I am followng the Automated setup https://docs.amplify.aws/lib/restapi/getting-started/q/platform/js
I have created the Data model using Amplify UI and run
amplify pull --appId XXXX --envName staging
and I got
Successfully generated models. Generated models can be found in /dev/extension/vue-extension/src
Post-pull status:
Current Environment: staging
| Category | Resource name | Operation | Provider plugin |
| -------- | ------------- | --------- | ----------------- |
| Api | my_custom_name | No Change | awscloudformation |
but when I run this code
import Amplify, { API } from 'aws-amplify';
import awsconfig from '#/aws-exports';
Amplify.configure(awsconfig);
API.get('my_custom_name', '/rankings').then(items => console.log(items)).catch(e=> console.log(e ));
I get
API my_custom_name does not exist
You're import awsconfig from '#/aws-exports'; looks incorrect.
Try changing it to import awsconfig from './aws-exports';
I am writing firebase security rules, and I am attempting to get a document that may have a space in its documentID.
I have the following snippet which works well when the document does not have a space
function isAdminOfCompany(companyName) {
let company = get(/databases/$(database)/documents/Companies/$(companyName));
return company.data.authorizedUsers[request.auth.uid].access == "ADMIN;
}
Under the collection, "Companies", I have a document called "Test" and another called "Test Company" - Trying to get the document corresponding to "Test" works just fine, but "Test Company" does not seem to work, as the company variable (first line into the function) is equal to null as per the firebase security rules "playground".
My thought is that there is something to do with URL encoding, but replacing the space in a documentID to "%20" or a "+" does not change the result. Perhaps spaces are illegal characters for documentIDs (https://cloud.google.com/firestore/docs/best-practices lists a few best practices)
Any help would be appreciated!
EDIT: As per a few comments, I Will add some additional images/explanations below.
Here is the structure of my database
And here is what fields are present in the user documents
In short, the following snippet reproduces the problem (I am not actually using this, but it demonstrates the issue the same way)
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /Users/{user} {
allow update: if findPermission(resource.data.company) == "MASTER"
}
function findPermission(companyName) {
let c = get(path("/databases/" + database + "/documents/Companies/" + companyName));
return c.data.authorizedUsers[request.auth.uid].access;
}
}
}
When I try to update a user called test#email.com (which belongs to company "Test"), the operation is permitted, and everything works exactly as expected.
The issue arises when a user, called test2#email.com, who belongs to company "Test Company" comes along and makes the same request (with authorization email/uid updated in playground, to match what is actually found in the company structure), the request fails. The request fails, since the get() call (line 1 of the function) cannot find the Company document corresponding to "Test Company" - indicated by the variable "c" being null in the screenshot (see below) - IT IS NOT NULL WHEN LOOKING FOR "Test"
Below is a screenshot of the error message, as well as some of the relevant variables when the error occurs
Check to see what type of space just in case it is another non-printable character. You could convert it to Unicode, and check what it might be. However, it is considered bad practice to use spaces in naming variables and data structures. There are so many different types to consider.
| Unicode | HTML | Description | Example |
|---------|--------|--------------------|---------|
| U+0020 |   | Space | [ ] |
| U+00A0 |   | No-Break Space | [ ] |
| U+2000 |   | En Quad | [ ] |
| U+2001 |   | Em Quad | [ ] |
| U+2002 |   | En Space | [ ] |
| U+2003 |   | Em Space | [ ] |
| U+2004 |   | Three-Per-Em Space | [ ] |
| U+2005 |   | Four-Per-Em Space | [ ] |
| U+2006 |   | Six-Per-Em Space | [ ] |
| U+2007 |   | Figure Space | [ ] |
| U+2008 |   | Punctuation Space | [ ] |
| U+2009 |   | Thin Space | [ ] |
| U+200A |   | Hair Space | [ ] |
i could not able to parse the below json value , I tried with parse_json() and todynamic() ,I m getting the result column values to be empty
]1
the issue is that your payload includes an internal invalid JSON payload.
it is possible to "fix" it using the query language (see usages of replace() in the example below), however it'd be best if you can write a valid JSON payload to begin with.
try running this:
print s = #'{"pipelineId":"63dfc1f6-5a43-5bca-bffe-6a36a435e19d","vmId":"9252382a-814f-4d02-9b1b-305db4caa208/usl-exepipe-dev/westus/usl-exepipe-lab-dev/asuvp306563","artifactResult":{"Id":"execution-job-2","SourceName":"USL Repository","ArtifactName":"install-lcu","Status":"Succeeded","Parameters":null,"Log":"[{\"code\":\"ComponentStatus/StdOut/succeeded\",\"level\":\"Info\",\"displayStatus\":\"Provisioning succeeded\",\"message\":\"2020-06-02T14:33:04.711Z | I | Starting artifact ''install-lcu''\r\n2020-06-02T14:33:04.867Z | I | Starting Installation\r\n2020-06-02T14:33:04.899Z | I | C:\\USL\\LCU\\4556803.msu Exists.\r\n2020-06-02T14:33:04.914Z | I | Starting installation process ''C:\\USL\\LCU\\4556803.msu /quiet /norestart''\r\n2020-06-02T14:43:14.169Z | I | Process completed with exit code ''3010''\r\n2020-06-02T14:43:14.200Z | I | Need to restart computer after hotfix 4556803 installation\r\n2020-06-02T14:43:14.200Z | I | Finished Installation\r\n2020-06-02T14:43:14.200Z | I | Artifact ''install-lcu'' succeeded\r\n\",\"time\":null},{\"code\":\"ComponentStatus/StdErr/succeeded\",\"level\":\"Info\",\"displayStatus\":\"Provisioning succeeded\",\"message\":\"\",\"time\":null}]","DeploymentLog":null,"StartTime":"2020-06-02T14:32:40.9882134Z","ExecutionTime":"00:11:21.2468597","BSODCount":0},"attempt":1,"instanceId":"a301aaa0c2394e76832867bfeec04b5d:0","parentInstanceId":"78d0b036a5c548ecaafc5e47dcc76ee4:2","eventName":"Artifact Result"}'
| mv-expand log = parse_json(replace("\r\n", " ", replace(#"\\", #"\\\\", tostring(parse_json(tostring(parse_json(s).artifactResult)).Log))))
| project log.code, log.level, log.displayStatus, log.message
On my method accountRepo.deleteAll()
return error:
2020-06-04 15:37:05.069 ERROR 78168 --- [ main] o.h.engine.jdbc.spi.SqlExceptionHelper : ОШИБКА: UPDATE or DELETE in table "account" violates foreign key constraint "fk8k31xl4ld2m810mxfkqp2xg8g" from table "tokens"
Details: on a key (account_id)=(2) there are still links in the table "tokens".
2020-06-04 15:37:05.071 INFO 78168 --- [ main] o.h.e.j.b.internal.AbstractBatchImpl : HHH000010: On release of batch it still contained JDBC statements
org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement
What could be the problem? This happens when creating a post-request with the registration of a user who will fall into accountRepo
My test and post-request:
#Test
#Throws(Exception::class)
fun shouldRegistrationExpected201() {
val headers = HttpHeaders()
headers.contentType = MediaType.APPLICATION_JSON
val request = HttpEntity<String>("{\"username\": \"holker228\", \"password\": \"123456QQwerty&&\",\"email\":\"test2#mail.ru\",\"is_collective\": \"false\" }", headers)
val responseEntity = restTemplate.postForEntity("http://localhost:$port/api/user/registration", request, String::class.java)
assertEquals(responseEntity.statusCode, HttpStatus.CREATED)
}
The issue seems to be in constrains configured in your database. BTW, which one do you use? In your particular case the constraint disallows DELETE (UPDATE?) operation as the row you're trying to delete seems to have dependent rows in another table.
E.g, imagine you have a table "users" and "comments":
users:
-------------
| ID | Name |
-------------
| 1 | Max |
-------------
| 2 | Vova |
-------------
| 3 | Vlad |
-------------
comments:
---------------------------------
| ID | User ID | Text |
---------------------------------
| 1 | 1 | Max was here! |
---------------------------------
| 2 | 1 | Vova + Vlad = ❤️ |
---------------------------------
| 3 | 2 | Don't listen to Max! |
---------------------------------
Here, if the constrains are configured, you cannot delete Max (1) or Vova (2) from "users" as they have comments. Imagine, you're rendering an HTML page and you need to render a comment's author's name? What would you do, if the author is deleted? (well, you can use "Anonymous", but let's not think about it). You cannot either change Max's or Vova's IDs for the same reason. So that's what constraints are for: they prevent such unconsistencies.
Ways to deal with this situation:
Update the related entities in the same transaction.
Use CASCADE for DELETEs. Take a look at this answer, for example
Freeze the IDs and do not change them.
I'm trying to introduce Sahara to my cloud to utilize Hadoop, and it's not going well. I tried to follow Openstack Documents but it didn't really help me. Now I'm trying to add sahara to my dashboard by command "pip install sahara-dashboard".
Sahara Dashboard is located : /usr/local/lib/python2.7/dist-packages/saharadashboard
original Dashboard is located : /usr/share/openstack-dashboard/openstack-dashboard, and I added
INSTALLED_APPS = [
'openstack_dashboard',
'saharadashboard',
'django.contrib.contenttypes',
'django.contrib.auth',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.humanize',
'django_pyscss',
'openstack_dashboard.django_pyscss_fix',
'compressor',
'horizon',
'openstack_auth',
]
this to /usr/share/openstack-dashboard/openstack-dashboard/setting.py.
and in : /usr/share/openstack-dashboard/openstack-dashboard/local/local_settings.py , I added
SAHARA_URL='http://localhost:8386/v1.1'
OPENSTACK_API_VERSIONS = {
"data-processing": 1.1,
"identity": 3,
"volume": 2,
"image": 2,
}
"data-processing": 1.1
SAHARA_USE_NEUTRON=True
I can see Sahara managment interface on Dashboard, but I'm getting this error when I try to register image in Image Registry tab of Dashboard. Hope you don't mind Korean in the image. I ought to tell you other things are working fine in my cloud. I searched through all logs related to Sahara, and nothing comes up.
I suspect that thses parts of code are where showing me the error, but don't know how to fix this issue. Please Help!
/usr/local/lib/python2.7/dist-packages/saharadashboard/image_registry/forms.py
glance = importutils.import_any('openstack_dashboard.api.glance',
'horizon.api.glance')
def _get_images(self, request, filter):
try:
images, _more = glance.image_list_detailed(request, filters=filter)
except Exception:
images = []
exceptions.handle(request,
_("Unable to retrieve images with filter %s.") %
filter)
return images
def _get_public_images(self, request):
filter = {"is_public": True,
"status": "active"}
return self._get_images(request, filter)
def _get_tenant_images(self, request):
filter = {"owner": request.user.tenant_id,
"status": "active"}
return self._get_images(request, filter)
UPDATE
glance image-list on controller
+--------------------------------------+------------------------------+
| ID | Name |
+--------------------------------------+------------------------------+
| 28747d2b-c113-4dd3-ad44-908141461e6d | cirros |
| ecb9ac84-7459-4b3b-a832-59329ae1e0ea | github-enterprise-2.6.5 |
| 39ce8087-f95b-4204-bcee-0f084735cba9 | manila-service-image |
| f9a678a8-492f-481e-8c82-5d0c84f69675 | mysqlTest |
| 5ae10b0d-c732-481a-944f-ca3a5a5f4915 | sahara-vanilla-latest-ubuntu |
| f9ea4193-1a92-434d-b247-27b748feb4a1 | Ubuntu Server 14.04 LTS |
+--------------------------------------+------------------------------+
You may have problem with keystone.Did you tried to restart keystone ?