omniware

Experience

18,140

0 Best Reply Awards

  • Member Since 1 Year Ago
  • 168 Lessons Completed
  • 4 Favorites

13th April, 2017

omniware left a reply on Laravel 5.1 Encrypt In JavaScript And Decrypt In Laravel. • 2 months ago

Finally I was able to use cryptjs to do this and this little sample code helped a lot https://github.com/brainfoolong/cryptojs-aes-php. Of course I couldn't use Crypt::decrypt.

12th April, 2017

omniware left a reply on Laravel 5.1 Encrypt In JavaScript And Decrypt In Laravel. • 2 months ago

If I do not want to use Laravel Crypt and achieve encrypting in AES-256-CBC on Javascript client side and decrypt on Laravel side, what are my options.

I know SSL already encrypts things, but I have peculiar situation.

omniware started a new conversation Laravel 5.1 Encrypt In JavaScript And Decrypt In Laravel. • 2 months ago

Hi I need to implement the Laravel's Crypt::encrypt($payload, $key) in Javascript/Jquery, that generate the cipher_text in a format that can be decrypted using Laravel's Crypt::decrypt function.

The Laravel's default Crypt functions uses APP_KEY as key to encrypt and decrypt. But as I have my own key to be used I used the following code to encrypt and decrypt.

    private function encrypt($plain_text, $key)
{
    /* set the key for encryption */
    $encrypter = new \Illuminate\Encryption\Encrypter(substr($key, 0, 32), Config::get('app.cipher'));
    /* encrypt the plain text */
    $encrypted = $encrypter->encrypt($plain_text);

    return $encrypted;
}

public function decrypt($cipher_text, $key)
{
    /* set the key for decryption */
    $decrypter = new \Illuminate\Encryption\Encrypter(substr($key, 0, 32), Config::get('app.cipher'));
    /* decrypt the cipher text */
    $decrypted = $decrypter->decrypt($cipher_text);

    return $decrypted;
}

The only issues now is how to encrypt in Javascript. I tried CryptoJS but the encrypted string that it generates is very different from what Crypt::encrypt generate, and I get Exception DecryptException in BaseEncrypter.php line 45:The payload is invalid.

Can you please help?

20th March, 2017

omniware left a reply on Laravel 5.4 Use Different Column Name And Table For Authentication • 3 months ago

@jlrdw Thanks for your response, but that question answers how phone or email can be used for logging in. I am trying to overload a few functions, but I see there are quite a few places where users are hard-coded in the code.

Actually I am migrating my Laravel 5.1 project to Laravel 5.4. these bottle necks are at migration from 5.2 to 5.3.

omniware left a reply on Laravel 5.4 Use Different Column Name And Table For Authentication • 3 months ago

No answers, is this that difficult to use a different table with different column names for auth in laravel 5.4?

19th March, 2017

omniware started a new conversation Laravel 5.4 Use Different Column Name And Table For Authentication • 3 months ago

What are the changes I need to do, after auth:make in Laravel 5.4 to use admins Table with admi_login and password to login, register, password reset and forgot password . The structure of admins table is as following.

                    $table->increments('admi_id');
        $table->string('admi_login');
        $table->string('admi_email')->unique();
        $table->string('admi_password', 60);
        $table->string('admi_active', 1)->default('n');
        $table->string('admi_remember_token', 100)->nullable();
        $table->timestamp('admi_insert_datetime');
        $table->timestamp('admi_update_datetime');

and structure of admin_password_resets tables is

        $table->string('email')->index();
        $table->string('token')->index();
        $table->timestamp('created_at');

7th February, 2017

omniware started a new conversation Forge And AWS In 2017 • 4 months ago

I created a EC2 using Forge, it started to build the machine, after a long time when I refreshed the new machine build row disappeared.

When I checked EC2 on AWS, machine is created, but there is no IP assigned to it.

Also when it is successfully created on forge sometimes I do not receive email from forge with sudo passwords.

Is this something known, is there a workaround to do the server creation correctly?

23rd January, 2017

18th January, 2017

omniware left a reply on Updating Config On Runtime For A User • 5 months ago

Anyone please?

16th January, 2017

omniware started a new conversation Updating Config On Runtime For A User • 5 months ago

I am using Laravel 5.1

I created a function to get smtp info from db for a user $mail_config=STMPDetails::where('user_id',36)->first() and then I can just call config helper function and pass the array to set config value 'config($mail_config). and then I callMail::queue` function.

but before it reaches [email protected]/laravel/framework/src/Illuminate/Mail/TransportManager.php where it reads the configuration again to send the mail, mail config are changed to the one specified in .env file.

I am not able to figure out where can I call the function such that configuration changes are retained before mail is sent.

Thanks, K

11th January, 2017

omniware started a new conversation What To Put In Server Providers->Amazon->Key/Secret • 5 months ago

I created an Ubuntu server on Amazon AWS. I registered for Forge, and trying to configure it. Selected source control to be Bitbucket. Now I am not sure what to put in key and secret after selecting Amazon in Server Provider Section.

20th December, 2016

omniware left a reply on Different .env File For Different URL • 6 months ago

This is how I solved it, in Laravel 5.1

    $environmentPath = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR;
$environmentFile = null;
switch (getenv('HTTP_HOST')) {
    case 'www.whitelabel.com':
        $environmentFile = '.whitelabel.env';
        break;
}
if (!empty($environmentFile) && file_exists($environmentPath . $environmentFile)) {
    Dotenv::load($environmentPath , $environmentFile);
}

omniware left a reply on Different .env File For Different URL • 6 months ago

@kamun I used Dotenv::load before seeing your response, but loadEnvironmentFrom look more promising, Thanks.

18th December, 2016

omniware started a new conversation Different .env File For Different URL • 6 months ago

I have a Laravel application running at www.myapp.com with its own logos and all, the logo file location is defined in a .env file.

Now I want to have a white-label of www.myapp.com application on www.whitelabel.com with its own logo.

I need to have two different .env files that need to be loaded at runtime e.g.

  • for www.myapp.com in URL it should use .myapp.env file
  • and for www.whitelabel.com it should use .whitelabel.env file.

Is this possible in Laravel 5.1, if yes how?

4th December, 2016

omniware left a reply on Has Many Relationship Create • 6 months ago

I run this as a Job every night at 1 am it does two things.

  1. get entries from the entire system and make entries in transactions table for everything before 12 am.
  2. then it has to aggregates these newly added transactions and puts them in aggregated table

Process makes sure these transactions are aggregated only in one of the aggreated_transaction rows

You are rightly pointed my objective here, but didn't understand how your suggestion improves the situation?

omniware started a new conversation Has Many Relationship Create • 6 months ago

I have two tables: transactions aggregated_transactions

I run a job every night that will create entries in transactions table that is followed by job to aggregate these new transactions stored in the transactions table by day and user and put them in aggregated_transactions table.

There is a hasMany relationship between aggregated_transactions and transactions table.

Thus after a aggregated transaction is created I need to update the transactions table with the newly created aggregated transaction ID.

Issues in this approach is

  1. I have to create entries in aggregated transaction one by one, even thou I have aggregated array that I could have bulk inserted in a go.
  2. After every aggregated transaction is created I need to update transactions table and need to also keep track of the transaction IDs I need to update.

Thus running so many DB queries (using SQL it is one query task, but I need to use Eloquent for consistency)

Is there a better way to do this using eloquent.

I was thinking if I could instead of hasMany have a ManyToMany relationship and keep track of the connection between two tables in a third pivot table.

Thanks, K

24th November, 2016

omniware left a reply on L5: API Validation And The New FormRequest Approach • 7 months ago

With Laravel 5.3 I did following in app/Http/Requests/PostRequest.php

/*
 * Validator instance updated on failedValidation
 *
 * @var \Illuminate\Contracts\Validation\Validator
 */
public $validator = null;

/**
 * Overrid Handle a failed validation attempt.
 *
 * @param  \Illuminate\Contracts\Validation\Validator  $validator
 * @return void
 *
 * @throws \Illuminate\Validation\ValidationException
 */
protected function failedValidation(\Illuminate\Contracts\Validation\Validator $validator)
{
//      throw new \Illuminate\Validation\ValidationException($validator, $this->response(
//          $this->formatErrors($validator)
//      ));
    $this->validator = $validator;
}

In my Controller function, I captured the $validation object public function create(PostRequest $request) { if (isset($request->validator) && $request->validator->fails()) { throw new \Exception('GEN-INVALID-PARAMS - ' . $request->validator->messages()->first(), 999); } ...

Hope this helps

8th November, 2016

omniware started a new conversation Forge Vs Forge Plus • 7 months ago

I am planning to get Forge. but not able to decide between Forge and Forge Plus.

Forge Plus says "Share Servers With Teammates." does this only mean teammates will have additional logins in forge site to look at my single server (assume I have only one server). or there will be users created on my single server for each user with different privileges?

Does Forge create users that I can use to directly access my server via putty?

5th November, 2016

omniware left a reply on Best Development To Production Route • 7 months ago

@sunergetic thanks for the hook pointer.

@willvincent I am thru the tutorials you shared, now I understand the flow I need to have, but I am thinking to replicate what git flow does instead of asking all my developers to learn gitflow and start following new process.

I will change step 4 to Merge to develop branch and the moment something merge to develop branch it will be pushed to a staging server, where we also do run the phpunit tests (which we now plan to write) as well do manual testing. Then I can merge the develop branch to master that would automatically push code to prod server.

I hope this plan would work, any suggestions here?

3rd November, 2016

omniware left a reply on Best Development To Production Route • 7 months ago

@willvincent thanks I go thru it today.

2nd November, 2016

omniware left a reply on Best Development To Production Route • 7 months ago

Git-flow seems interesting... Pointers to any good tutorials (preferably video tutorials) please. Thanks.

omniware left a reply on Best Development To Production Route • 7 months ago

You are right step 1-4 doesn't change and really the point point is testing before it goes to prod, we do not have unit test cases, we do manual testing and it is right now directly on production server (dangerous, thou we first in local dev env), there is no test or staging env.

omniware started a new conversation Best Development To Production Route • 7 months ago

What is the best development to production route with Laravel project.

Current dev tools: XAMPP 7.0 (with php 7 and mysql) on local machine with developers fav IDE on Windows 10. Current production tools: Apache2 with php7 and mysql on Ubuntu 14 running on AWS EC2 Current process:

  1. Development happens on local machine.
  2. Code is Committed in git and branch pushed to bitbucket
  3. Pull request is created.
  4. Code review and Merge to master.
  5. On prod server, git pull origin master && composer install && php artisan migrate && php artisan cache:clear to deploy the code.

This process is becoming difficult to manage as the team size is growing.

21st October, 2016

omniware left a reply on SMTP Setting For Each USER • 8 months ago

@Braunson Thanks, This is helpful, probably I will create a package for this myself.

20th October, 2016

omniware left a reply on SMTP Setting For Each USER • 8 months ago

@wolle404 I am looking for a plugin if there is any (I couldn't get any in my search) @Snapey user will put there smtp credentials. and I will use those to push there mails to there own audience.

omniware started a new conversation SMTP Setting For Each USER • 8 months ago

Is there a laravel package for setting up smtp setting for each user, user account is going to send mails to his audience?

15th October, 2016

omniware started a new conversation ACL And Admin • 8 months ago

I am planning to build a site in Laravel 5.3 with Admin LTE template.

Few things I am not able to understand how to do.

One organization will have one registration with super user access, using those credentials they can create more users with different access levels.

Now one Organization has many users to login in same account. How do I model this?

Note that there is a back-end as well that me and my team will have access to with different access levels again. I also need to model this.

12th October, 2016

omniware left a reply on Storing Dynamic Columns • 8 months ago

I will give that a try with mangodb.

I really liked the concept IsraelOrtuno/Eavquent, but it is still under development, it doesn't solve the efficiency problem, but we can easily query the models. I was trying it, there are issues that I am trying to resolve but insufficient documentation is not not helping.

omniware left a reply on Storing Dynamic Columns • 8 months ago

Can I use both mysql and mangodb in one project. I will using mango only for storing these dynamic data?

omniware left a reply on Laravel Passport Error - ServerException In RequestException.php Line 107: • 8 months ago

On my consumer.dev when I changed the database to point to same database as the one used for passport.dev everthing fell in place, but it is not logical to do so, Can anyone tell why should I have the same database on consumer.dev.

passport.dev .env file

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=passport
DB_USERNAME=root
DB_PASSWORD=null

consumer.dev .env file

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=passport
DB_USERNAME=root
DB_PASSWORD=null

omniware left a reply on Storing Dynamic Columns • 8 months ago

Thanks for your response, the problem with json string it is not easy to query. I use server side data tables using yajra's datatables package, that needs a builder instance to work on.

Second approach is not scalable, there will be a limit to number of columns I can have.

I was looking at eav model but that seems very inefficient. And also difficult to query.

Any other way to achieve this in a relational format , I do not mind complexity, but it should be flexible and easy to query using a SQL query at the end of the day.

11th October, 2016

omniware started a new conversation Storing Dynamic Columns • 8 months ago

I need a data model to store and then easily retrieve data using Eloquent for the following scenario.

My User logs in and creates a Custom Form 1 with 3 fields (name, email, dob) and distributes it to his Friends. 15 Friends fill the form 1. My user user creates another Custom Form 2 with 4 Fields (name, email, phone, subject) and distributes to his Teachers. 6 Teachers fill the form 2.

Now my User needs to see the data for

  • Form 1 (having 15 rows and 3 columns)
  • Form 2 (having 6 rows and 4 columns)

What is the best way to deal with dynamic number of columns?

8th October, 2016

omniware started a new conversation Route Without Default Middleware • 8 months ago

In Laravel 5.3, when I add a route in web.php it adds a default web middleware to it. I do not to add the default middleware but my own middleware only. How can I remove the default route to not apply no a specific route? I need this specially for the few routes where I do not want verify csrf token, I can add the route in the exception list, but this is something that is going in my package.

7th October, 2016

omniware left a reply on AJAX Form Validation Using Request • 8 months ago

I am on laravel 5.1, and not yet started using vuejs

omniware started a new conversation AJAX Form Validation Using Request • 8 months ago

I usually use Request to validate form data, e.g. For my TestController, I use TestRequest to define my rules. I case of ajax I use something as following, i.e. making a validator in controller's function,

// Setup the validator
$rules = array('username' => 'required|email', 'password' => 'required');
$validator = Validator::make(Input::all(), $rules);

// Validate the input and return correct response
if ($validator->fails())
{
    return Response::json(array(
        'success' => false,
        'errors' => $validator->getMessageBag()->toArray()

    ), 400); // 400 being the HTTP code for an invalid request.
}
return Response::json(array('success' => true), 200);

How can I use my TestRequest with a ajax request, that would also prepare the proper error response

5th October, 2016

omniware left a reply on Sync Client Instances • 8 months ago

Exactly, Thanks. Laravel Echo

omniware started a new conversation Sync Client Instances • 8 months ago

I saw a video few months back, Taylor demonstrate a technic in laravel where two different browser windows were in sync, change in a value in one window reflected the change in another window, but I am not able to recall where I saw it and what is it called. Can someone help me recall it.

4th October, 2016

omniware left a reply on Safe Guarding Files Stored In AWS S3 • 8 months ago

@kobear that means in img tag I should have a route like http://mysite/images/abc.png and a controller fetch content of this file from aws url https://s3.ap-south-1.amazonaws.com/test-bucket/abc.png on to my server and pass it to my users browser.

Right now as all files are exposed to internet my img tag has direct src to aws url.

Now following the controller approach there will be additional stress on my server as well apart from the transfer that happens from S3 to my server.

Earlier I was having all these user image files in my storage folder and I was using the similar approach as you mentioned. I am not seeing the addvantage of using S3 like this.

omniware started a new conversation Safe Guarding Files Stored In AWS S3 • 8 months ago

I started using S3 to store my user files using laravel-mediable package, it all works fine, but all files stored in S3 are accessible directly via internet.

If I have user photo that I want to display only when user is logged in what is the way to set this up.

18th September, 2016

omniware started a new conversation Micro-Site Fro User Using Laravel • 9 months ago

I want to create a micro-site (single page) for each of my registered user with a subdomain like user1.exampl.com, user2.example.com, what is the best way to do this using laravel

4th August, 2016

omniware left a reply on Starter Application (Vue.js, Laravel, Dingo, JWT) • 10 months ago

@ciurinho I am sure by now you would have figured it all out, last night when I was trying to install this I got the same error, How did you solve the issue?

26th July, 2016

omniware left a reply on Laravel Create Dynamic Forms Via A Drag And Drop Interface • 10 months ago

@jekinney Thanks I am exploring it now

25th July, 2016

omniware left a reply on Laravel Create Dynamic Forms Via A Drag And Drop Interface • 10 months ago

@ricardovigatti @jekinney , I am sure it would be really easy to do it via Vuejs, sadly I am in video lesson 5 yet :(, (I have very little hands on with front end frameworks, only basic jQuery).

@jekinney are you creating that thing for yourself or can we expect it available in open source?

22nd July, 2016

omniware left a reply on Laravel Create Dynamic Forms Via A Drag And Drop Interface • 11 months ago

I was asking if there are libraries already that can help me achieve this.

Well I kind of found one https://github.com/minikomi/Bootstrap-Form-Builder, but its half the story, its just the client side.

Challenge for me is after the Form is built with this library I get HTML code, shall I save the html code in database? If I save the html code in DB I can retrieve it and render it in the page, but is this best way to save dynamic forms?

Now when users starts pushing data using this form, how do I store these form values in table, as some forms might have many form fields some have a few. Making a table with many-many columns half of which isn't used does not feel right to me, there has to be a better way.

omniware started a new conversation Laravel Create Dynamic Forms Via A Drag And Drop Interface • 11 months ago

I have been searching for this for a while now. Can you suggest some thing that is packaged for Laravel. Few interesting ones are the http://form.io (commercial) and http://bootsnipp.com/forms (its a tool).

My requirement is my clients can login and create these forms for there users. Client's User see these forms in client specific urls e.g. www.mysite.com/clientname/form_uuid/

I really wish I get something that is like bootsnipp/form

8th May, 2016

omniware left a reply on PHP Artisan In Git Bash • 1 year ago

I have the same issue on windows 10.

Changing Git Bash options for terminal to "xterm-256color" does NOT work for me.

Any other suggestion?

13th April, 2016

omniware left a reply on PhpUnit And Access To External URL • 1 year ago

Looks like people are not using phpunit much :|, am I using the right tool for testing? Anyone please, there is something strange going on with the $base_url, APP_URL and the visit function parameters that I am not able to figure out.

11th April, 2016

omniware started a new conversation PhpUnit And Access To External URL • 1 year ago

On my windows PC I have an instance of laravel 5.2 running and I have one named route in it called testroute.

I wrote a phpunit test cases

public function testBasicExample1() {
    $this->visit('testroute')->see('Something'); //Passes
}
public function testBasicExample2() {
    $this->visit('http://www.google.com')->see("I'm Feeling"); //Fail
}

in TestCase.php $baseUrl = 'http://localhost:8000';

and in .env APP_URL=http://localhost:8000

How do I access external URLs in laravel phpunit testcases?

I need this as I have a separate non-laravel api server and I need to access those and test responses in my laravel project.

Thanks

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.