I have table tb_barang.
So I create model Barang with enable table_prefix.
Then, I create crud, with model app\models\Barang and controller: app\Controllers\BarangController
I have use htaccess and enable pretty_url and everything is fine. ex
localhost/yii_app/web/site.
But when pointing to localhost/yii_app/web/barang
its
Not Found (#404)
Why gii failed ?
This might be helpful to you.
app\models\Barang ==> model name
app\Controllers\BarangController ==> controller name
views\barang\index.php ==> inside views folder create barang folder then your index.php like this this order
Related
I am using Angular6-json-schema-form library and included
import { Bootstrap4FrameworkModule } from 'angular6-json-schema-form'
in the app.module.ts file. Also i created a JSON schema object in the component file and used the below in the app.component.html file
<json-schema-form loadExternalAssets="true" [schema]="yourschema" framework="bootstrap-4"></json-schema-form>
But when i do npm start and do a localhost i am getting an error in the console
ERROR Error: schema with key or id "http://json-schema.org/draft-06/schema" already exists
Can anyone please help me in resolving the issue.
It seems like there are two JSON schemas within your project both having the id of "http://json-schema.org/draft-06/schema". There could be two reasons for this:
There is actually another JSON schema file you are using with the same exact id.
There is only one schema with this id but the framework is having a hard time reading your $id off the schema. We also had some difficulties reading $id with this framework back in our team. try removing the $id and its value and re-run your app.
Create a folder if it doesn't exist in Magento, I don't want to use mkdir(). Is there any way to do this ? May be core_file_uploader can work out, but its throwing error.
Magento has Varien_Io_File class for quite many filesystem works.
So instead of using PHP's vanilla mkdir() function, you can use the Magento's way:
$io = new Varien_Io_File();
$io->mkdir(your_path_to_dir);
Or you can also check if the directory does not exist right before creating it
$io = new Varien_Io_File();
if (!$io->fileExists(your_path_to_dir, false)) {
$io->mkdir(your_path_to_dir);
}
On a django 1.11 application which uses mysql , I have 3 apps and in one of them I have a 'Country' model:
class Country(models.Model):
countryId = models.AutoField(primary_key=True, db_column='country_id')
name = models.CharField(max_length=100)
code = models.CharField(max_length=3)
class Meta:
db_table = 'country'
Whaen I try to makemigrations I get this error:
django.db.utils.ProgrammingError: (1146, "Table 'dbname.country' doesn't exist")
If I run making migration for another app which is not related to this model and its database table using ./manage.py makemigrations another_app, I still get this error.
I've had this problem and it's because I was initializing a default value somewhere in a model using... the database that I had just dropped. In a nutshell I had something like forms.ChoiceField(choices=get_some_data(),...) where get_some_data() used the database to retrieve some default values.
I wish you had posted the backtrace because in my case it's pretty obvious by looking at the backtrace that get_some_data() was using the orm (using something like somemodel.objetcs.filter(...)).
Somehow, Django thinks you've already created this table and are now trying to modify it, while in fact you've externally dropped the table and started over. If that's the case, delete all of the files in migrations folders belong to your apps and start over with ./manage.py makemigrations.
Review, if you have any dependencies, is possible same Model need the Model Country in the same app or other app like:
class OtherModel(models.Model):
country = models.ForeignKey(Country)
1.- If is True, you need to review if installed_apps in settings.py have the correct order of apps, if is in the same app, you need to declare first a Country app and then the dependents.
2.- If dependent is in the same app, the dependent Model need to be declared after Country model in models.py.
3.- Review if the error track on console talk about same erros on models.py or forms.py
4.- Review if when executing makemigrations and migrate is the correct order of apps: python manage.py makemirgations app_of_country, other_app_name
How to delete files in laravel 5.4
I tried this
\Storage::delete($path);
and this
\File::delete($path);
and it told me Method delete does not exist
I think your Files and Images are in Folder and Database. So , you need to Delete Files and Images from Folder and Database. I think you have already created a Delete button in View file and you have passed the id. Then try this..
after namespace App\Http\Controllers; , write this below codes.
use DB;
use File;
In your Controller file code like this.
I think your Files and Images store in public folder. That why I use \File::
function delete($id)
{
$query = DB::table('academic')->where('id',$id);
$files_to_delete = $query->pluck('Db_ImageorFile_Column_Name')->toArray(); //keeping the result in a php
$query->delete(); // For delete from database
\File::delete($files_to_delete); // For delete from folder
return redirect('Your_Page_Name');
}
If you have further Questions , use these Links -
) How To Delete Files Or Images From Folder And Database In Laravel?
) How to delete file from public folder in laravel 5.1
) https://laracasts.com/discuss/channels/laravel/how-to-delete-a-file-or-a-photo-from-the-folder-when-deleting-it-from-database?page=1
I'm trying to create a custom AttributeType with OpenLDAP without success...
I have a very basic/default LDAP configuration using the cn=config method.
My goal is to create a custom attribute type "memberOfGroups" for my generic user accounts. The syntax shall validate at least this kind of regular expression: [a-zA-Z0-9]+(,[a-zA-Z0-9]+)* in other words one,or,several,words,separated,by,comma.
So, first of all, I think I should create a new olcAttributeTypes, then modify the inetorgperson and add this Attribute type. Am I right?
This is my ldif file:
# cat -A ~/add_attribute.ldif
version: 1$
$
dn: cn={4}custom,cn=schema,cn=config$
changetype: modify$
add: olcAttributeTypes$
olcAttributeTypes: ( 1.3.6.1.4.1.1234.1$
NAME 'memberOfGroups'$
DESC 'Appartenance a un groupe.'$
SYNTAX 1.3.6.1.4.1.1466.115.121.1.44 )$
And I'm using the following ldapmodify command:
# ldapmodify -xf ~/add_attribute.ldif -D 'cn=admin,dc=ldap,dc=jlo,dc=lab' -W
The result is:
modifying entry "cn={4}custom,cn=schema,cn=config"
ldap_modify: No such object (32)
matched DN: cn=schema,cn=config
So I tried :
with ldapadd command, with the same result.
changing the "changetype" to "add", not working too.
Then I'm asking myself if I'm using the right DN. Indeed, the cn={4}custom file doesn't exist yet in the /etc/ldap/slapd.d/cn=config/cn=schema directory.
Should I create it before or will it be automatically created?
I'm a little confused with the LDAP configuration...
Thanks in advance for any help.
I progressed (a little). I created a new file for my custom attributes. This is my ldif:
dn: cn={4}custom,cn=schema,cn=config
changetype: add
objectClass: olcSchemaConfig
cn: custom
dn: cn={4}custom,cn=schema,cn=config
changetype: modify
add: olcAttributeTypes
olcAttributeTypes: ( 1.3.6.1.4.1.1234.1
NAME 'memberOfGroups'
DESC 'Appartenance a un groupe.'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.44 )
But don't see the memberOfGroups attribute in phpldapadmin > schema > attribute types. I don't now if this is a phpldapadmin problem or not.
Then, I think I should associate this attribute to the inetOrgPerson objectclass.