I know of #RachidLaasri/LaravelInstaller but it is rather a kind of different thing I want.
I want to do something like, go to a URL like localhost::8000/installer. Then, it will display a page for super admin registration, i.e., email, password, and username. Note: I want to eliminate the ability of making my superadmin app user going to the UsersTableSeeder to configure anything.
Then, when I click on install, it migrate my seeded classes. I currently watched the command line app but still can't really figure out how to go about this.
Any advice / tip will be appreciated.
Laravel Installer
add 2 router in your project.
http :
routes.php
routes2.php
---
view
application/
installation/
in first route you should take db name and more information you need from user. Save db name to .evn file.
After then you might create database using php codes, How to make db Pdo
and run \Artisan::call('migrate') in your Controller.
Rename route to installation-route using php rename method file. And rename route2 to route.
Have you tried this PHP Application Installer
This library can be used for PHP appplication configuration(database, admin credentials etc) using user interface.
Related
I am using laravel for my web application. I have integrated amember within my larvel site inside /publi/amember. Now i want to protect my routes using amember. Anyone knows how to do it. I am using L5 Moduler structure for my larvel site.
The best approach is use Am_Lite API to do it.
http://www.amember.com/docs/API/Lite
So you need to include this file
amember/library/Am/Lite.php
within your application (before any output done) and then use the following call to check access:
Am_Lite::getInstance()->checkAccess(Am_Lite::PAID);
In event of user has necessary access then this call do nothing otherwise redirect user to login form.
I am working on a Symfony 2 WebApp that uses the PayPal Rest API to create and accept PayPal payments.
To be able to redirect each user to a PayPal page in his language, one has to create an Experience Profile for each language/locale.
Each Experience Profile has to be created only once. For example once a profile for US locale has been create, this profile can be re-used for every customer using the same locale:
Customer enters his address and contry XY on my page
My page checks if profile for XY locale exists
Create new profile for XY locale and store it OR re-use existing one
Each profile has a unique ID. Thus I am looking for a method to store Locale/ID pairs. A simple solution would be a JSON file. But where to store this file within the Symfony structure?
Profiles are created on the fly when ever a user from a new country places a payment. Thus this data is created during runtime and because of this it does not belong into the standard config dirs of Symfony I think. I do not even know if these folders should accessible/writeable by my code.
So: What is the right place to store such a file.
EDIT:
As #JimL pointed out in the comments it would of course be possible to store the data in the DB. However the Payment Bundle I am working on, should be used in different projects and thus be as separated from the rest of the project as possible.
The goal here is, to store the data in a file, not in the DB. Of course the DB is much more efficient but in this special case a simple file will be sufficient.
The question is: Where to store this file? First idea is to use /MyBundle/Resources/config since this dir holds all other config files. But is this the right place for files that change at run time as well?
Standard Symfony directory structure for 3.x is:
app/
The application configuration, templates and translations.
bin/
Executable files (e.g. bin/console).
src/
The project's PHP code.
tests/
Automatic tests (e.g. Unit tests).
Standard Directory Structure is:
var/
Generated files (cache, logs, etc.).
vendor/
The third-party dependencies.
web/
The web root directory.
You can put it in the standard var directory under your custom directory. Remember about permissions.
More general info on var directory:
http://www.linfo.org/var.html
So I have designed a PHP application that uses an oAuth2 API integration to create a unique interface for a CRM. App is working great on my server, and am ready to offer it to my clients.
My initial idea for expanding this was to create a unique subdomain for each of them on my server, create a new database, and install my application onto that subdomain. My application only has one hard-coded file with the database login details, the rest is stored on a database.
The problem I see with this is it is inefficient. I am essentially going be putting in the same files in many directories, which doesn't make a whole lot of sense. Plus updating it would be annoying.
Since everything is being hosted by me, it was suggested that I create a core folder with all of the files. Then I could use a loader script to read the database settings, and then use relative paths to access the core folder.
My issue is how would this work? Suppose my core domain is https://core.mydomain.com and my customer url is https://cus.mydomain.com. Customer logins through their url. Now a customer wants to access https://cus.mydomain.com/person.php. How would I make that work, considering that file is not located there (since it is in the core folder)? Would this require using custom htaccess?
If my current idea is wrong, what approach would you suggest? I am not married to this approach, and am looking for an efficient way of updating and managing the app. Thank you!
Use a symbolic link?
https://en.wikipedia.org/wiki/Ln_(Unix)
You can create a folder with all your static files in /var/www/core/ and create a symbolic link in each customers folder.
ln -s /var/www/core /var/www/customer001/core/
this way all modifications in /var/www/core/ will be available to all customers
Is there a way to integrate elfinder with my current user permissions system? I would need some kind of hook which would be triggered before e.g. a file gets deleted. There I should be able to abort the delete command and return some kind of response if the logged in user doesn't have enough permissions.
Closest thing I found until now is this: Connector Configuration options - Bind
But it doesn't look like I'm able to abort the current action there....
It all depends on the way you implemented the server-side connector.
For example, I have a custom connector for PHP backend which saves and returns the files / folders based on a database table. This way, I can set the read and write options for each file / folder (check the Client-Server API docs).
To answer your question, you'll need to tweak the server side connector to set the read and write attributes, like stated in this wiki page.
I am facing a issue. I have to fetch data from moodle without loggin to it. I have to create a seperate php which is not a part of moodle directory. This file will fetch course from moodle database and display it.
Please help me to sought it out.
Try looking up the database credentials for moodle in the config file and use them to read straight from the database with a different PDO DSN?
The right place to start would probably be to look at using the Moodle web services (https://docs.moodle.org/en/Web_services), before you start trying to directly pull information from the Moodle database.
You will need to use Moodle web services. You can see the steps to set it up by going to yourmoodleurl/admin/settings.php?section=webservicesoverview. Basically,
Enable web services: yourmoodleurl/admin/search.php?query=enablewebservices
Choose which protocol your service will use: yourmoodleurl/admin/settings.php?section=webserviceprotocols
Create service by going to yourmoodleurl/admin/settings.php?section=externalservices and clicking the linked text "Add", give your service a name and select the box to enable, then save.
Add functions to the service you just created. You probably want something like core_course_get_contents, but you can study the list of api functions at yourmoodleurl/admin/webservice/documentation.php to see which functions will get you the data you want.
Create a user and token that will use the service. I create a user called webservice, and make the authentication method "web services authentication", and make the user a site administrator. You may not want to do that for security reasons, and just grant the webservice:createtoken privilege along with whatever privilege is necessary to access the webservice function.
Execute your webservice with your external script.