samedi 29 avril 2017

Add funds integration in php

m trying to find any script or integration in php or laravel to make add balance to my website.

like i have 100 us in any payment gateway and i want to put on my website.

thanks Caesar.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2oTLH0r
via IFTTT

$array[]='something' analog in Laravel array session logic

I can create session array in Laravel only with defining key by hand using Session::put('items.key','1'), but I have a situation when I just need keys to be made automatically as I would use simple PHP function $items[]=value. How can I do this in Laravel session?

P.S. I have tried Session::put('items[]','1'), but it doesn't worked.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2psVpbV
via IFTTT

socket_connect keeps failing with permission denied

I am running into the following error message:

socket_connect(): unable to connect [61]: Connection refused

The code that I am using:

$address = 'localhost';
$port = 5600;
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_connect($socket, $address, $port);

I was trying this out on a valet .dev environment with nginx so I guessed it might have to do with not having a proper development environment that supports websockets but after testing I am getting the exact same on my homestead vagrant environment.

Any help with getting more verbose debugging information or a possible solution would be amazing.

All suggestions are welcome.

Cheers.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2oT2YH0
via IFTTT

remove all CSS image style but keep html attributes (width and height)

i am storing html text in the database for example:

<p><img title="dasdasd" src="storage/posts/April2017/lKZCxXpP.jpg" alt="asdasd" width="100" height="100"/></p>

and then in another page i am displaying this text as html, consider it as a post body that need to be displayed with formatting.

the problem is that i am using a template that contain a lot of styling. in the style.css i have

img {  max-width: 100%;   height: auto;   width: 100%; }

its from the template styling and i cannot change this because it will mess up all my template.

the problem

the template styling is overriding the style of the image width ="100" height="100" that is stored with the html in the database, so i need the image to use the width and height that are provided by the creator of the post and stored in the database.

i already tried

height: unset;  width: unset;

but it will revert back the image to its original size not the one provided by the post creator.

is there anything i can do beside changing all the img style of themplate?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2oWp3Fi
via IFTTT

Can't redirect users to custom URL after succesful login in Laravel

I am trying to redirect the users to a custom URL after a succesful login but it doesn't work. It keeps redirecting users to this dashboard page "/". I already deployed the website to the server so I can't clear the route cache with artisan.

Laravel version is 5.3.29

App\Http\Controllers\Auth\LoginController.php

<?php

namespace App\Http\Controllers\Auth;

use Illuminate\Support\Facades\Log;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;

class LoginController extends Controller
{
    use AuthenticatesUsers;

    protected $redirectTo = '/my-profile';
    protected $redirectPath = '/my-profile';

    protected function redirectTo()
    {
        return '/my-profile';
    }

    public function __construct()
    {
        $this->middleware('guest', ['except' => 'logout']);
    }
}

App\Http\Middleware\RedirectIfAuthenticated.php

<?php

namespace App\Http\Middleware;

use Closure;
use Illuminate\Support\Facades\Auth;

class RedirectIfAuthenticated
{
    public function handle($request, Closure $next, $guard = null)
    {
        if (Auth::guard($guard)->check())
        {
            return redirect('/my-profile');
        }

        return $next($request);
    }
}

I have read that there might be some problems with Laravel in this post. It says that there might be some problems with this file: /vendor/laravel/framework/src/Illuminate/Foundation/Auth/RedirectsUser.php, but this error was fixed in Laravel version 5.3.29, but I can see that it is fixed and 'returnTo' method should work.

/vendor/laravel/framework/src/Illuminate/Foundation/Auth/RedirectsUser.php

<?php

namespace Illuminate\Foundation\Auth;

use Illuminate\Support\Facades\Log;

trait RedirectsUsers
{
    /**
     * Get the post register / login redirect path.
     *
     * @return string
     */
    public function redirectPath()
    {
        Log::info("RedirectsUsers");
        if (method_exists($this, 'redirectTo')) {
            return $this->redirectTo();
        }

        return property_exists($this, 'redirectTo') ? $this->redirectTo : '/homeeeee';
    }
}

And my routes file:

<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of the routes that are handled
| by your application. Just tell Laravel the URIs it should respond
| to using a Closure or controller method. Build something great!
|
*/

Auth::routes();

Route::get('/', 'HomeController@index');

Route::get('/home', 'HomeController@index');

Route::get('/confirm-your-email', 'Auth\ConfirmEmailController@confirm_email');

Route::get('/confirm-email/{register_token}', 'Auth\ConfirmEmailController@index');

Route::get('/my-profile', ['as' => 'my-profile' , 'uses' => 'MyProfileController@show', 'userAlert' => null]);

Route::post('/my-profile/edit-about', 'MyProfileController@editAbout');

Route::post('/my-profile/edit-profile-picture', 'MyProfileController@editProfilePicture');

Route::get('/search/company', 'SearchController@searchCompany');

Route::get('/my-profile/add-job', 'MyProfileController@addJobPage');

Route::get('/my-profile/add-job/{id}', 'MyProfileController@addCompanyJobPage');

Route::post('/my-profile/add-a-job', 'MyProfileController@addJob');

Route::post('/my-profile/delete-job', 'MyProfileController@deleteJob');

Route::get('/users/{id}', ['as' => 'users', 'uses' => 'UserController@show']);

Route::get('/rate/user/{id}', ['as' => 'rate', 'uses' => 'RateController@showUserRate']);

Route::post('/rate/rate-user/{id}', 'RateController@rateUser');

Route::get('/invite-user-rate/{id}', 'RateController@showInviteUserToRateYou');

Route::post('/invite-rate/user/{id}', 'RateController@inviteUserToRateYou');

Route::get('/company/{id}', ['as' => 'company', 'uses' => 'CompanyController@show']);

Route::get('/rate/company/{id}', 'RateController@showCompanyRate');

Route::post('/rate/rate-company/{id}', 'RateController@rateCompany');

Route::get('/search/{page}/results/', 'SearchController@showSearchCompanies');

Route::get('/search/{page}/people/results', 'SearchController@showSearchPeople');

Route::get('/leave-a-rating/', 'SearchController@showLeaveARating');

Route::get('/invite', ['as' => 'invite', 'uses' => 'OtherAuthentificatedController@showInvite']);

Route::post('/email-invite', 'OtherAuthentificatedController@emailInvite');

Route::get('/contact', 'OtherController@showContact');

Route::post('/send-contact-email', 'OtherController@sendContact');

Route::get('/tyfcu', 'OtherController@thankYouForContactingUs');



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2oJq6wg
via IFTTT

Laravel 5.4: Delete Modal Not Obtaining Object

So I have a table of people, with each column containing certain values. At the end of each row, I have a "Delete" button. When that button is pressed, a modal pops up to confirm if you want to proceed with deleting that person. Clicking the "Delete" button again should delete the person and display a success message for it.

With the modal, I'm trying to make sure not only that a user needs to accept the action before proceeding, but also making sure that only the specific person in question is deleted. However, when I try to clarify the request it only contains the CSRF token that I'm passing through. Even when I try to more deliberately inject the targeted person into the modal the person isn't being sent through.

The important snippets of my code, for reference:

@foreach($people as $person)
   <tr id="row">
       <td id="first_name_row"></td>
       <td id="last_name_row"></td>
       <td id="email_row"></td>
       <td>
         <input type="button" id="delete_button_row" class="btn btn-btn-submit delete" value="Delete" onclick="delete_modal('', )">
       </td>
   </tr>
@endforeach

..........

<!-- Modal -->
    <div class="modal fade" id="DeleteModal" role="dialog">
        <div class="modal-dialog">
            <form class="form-horizontal style-form" id="model-form" data-toggle="validator" role="form" method="post" action="/employer/delete-person">
              <!-- Modal content-->
              
              <div class="modal-content">

                  <div class="modal-header">
                      <button type="button" class="close" data-dismiss="modal">&times;</button>
                      <h4 class="modal-title">Delete This Person</h4>
                  </div>
                  <div class="modal-body">
                      <p>Are you sure you would like to do that?</p>
                      <input id="delete_ex">
                  </div>
                  <div class="modal-footer">
                      <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
                      <button type="submit" id="modal-execute" class="btn btn-btn-submit">Delete</button>
                  </div>
              </div>
          </form>
        </div>
    </div>

......

<script>

  function delete_modal(num, person){
    $('#delete_button_row' + num).attr("data-toggle" , "modal");
    $('#delete_button_row' + num).attr("data-target", "#DeleteModal");
    $('#delete_ex').val(person);
  }

  .......

</script>



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2pvztiq
via IFTTT

Laravel 5 remember me not working

I am unable to get Laravel rememeber me functionality to work.

I added remember token column to my User Model table. My User Model Authenticatable. User model doesn't contain anything else specific related to remember me functionality

I am using default Auth drivers and guard.

My Usercontroller is different from default one. It extends from Controller. It doesn't use any Traits. In my login method, I use Auth::login($userModelObject, true) to login user. Everything works fine. Remember me token gets updated in database. I can see 3 cookies on browser XSRF-TOKEN, laravel_session, remember_web_59ba36addc2b2f9401580f014c7f58ea4e30989d.

Auth::check() returns true as expected but if I either remove, expires, or modify laravel_session, in the subsequent request, remember_web_59ba36addc2b2f9401580f014c7f58ea4e30989d cookie also gets removed for some reason (I am not able to view i$t using var_dump($_COOKIE) in only middleware I applied) and I think that's why Laravel Auth driver isn't able to use remember me Cookie to autologin user. CSRF middleware is also being applied automatically by Framework.

What could be causing this behaviour? Do I need to use some Additional Traits on my User Model or Controller?

Note: I am using Laravel 5.4 and my session config are:

'driver' => env('SESSION_DRIVER', 'file'),
'lifetime' => 20,
'expire_on_close' => false,
'encrypt' => false,
'files' => storage_path('framework/sessions'),
'connection' => null,
'table' => 'sessions',
'store' => null,
'lottery' => [2, 100],
'cookie' => 'laravel_session',
'path' => '/',
'domain' => env('SESSION_DOMAIN', null),
'secure' => env('SESSION_SECURE_COOKIE', false),
'http_only' => true



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2qiqkrF
via IFTTT