vendredi 1 avril 2016

Setting of sql mode is not working in mysql

i am using below query for setting sql mode in database

SET @@sql_mode = ''

it shows successful, but my database sql_mode is not changed.

help me another way.

Thanks in advance.......



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

Larevl5.1 Join Query for 4 Tables

I need to join four tables in Join using Laravel and i need to get count of the values from 2 tables along with the other two table datas.

Table Name: users / timesplayed / user_avatar / privatemessages

I need to get all values from users and user_avatar table and Count of rows from the other Two Tables.

I have used the following join Query but i am getting count Error on joining the privatemessages table.

Can u rectify what is wrong in this Join Query.

$user_id = Auth::user()->users_id;
return $user_information = DB::table('users')
                        ->join('timesplayed','users.users_id','=','timesplayed.users_id')
                        ->join('user_avatar','user_avatar.user_avatar_id','=','users.avatar')
                        ->join('privatemessages','privatemessages.to_user_id','=','users.users_id')
                        ->select('users.*',DB::raw('COUNT(timesplayed.users_id) as total'),'user_avatar.user_avatar_id',DB::raw('COUNT(privatemessage.privatemessage_id)'))
                        ->where('privatemessages.status','=',1)
                        ->where('users.users_id','=',$user_id)
                        ->get();



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

Method [header] does not exist on view - Laravel 5

I have created a middleware to restrict the page going back inside the dashboard as follows:

namespace App\Http\Middleware;

use Closure;

class ValidateBackButton {

/**
 * Handle an incoming request.
 *
 * @param  \Illuminate\Http\Request  $request
 * @param  \Closure  $next
 * @return mixed
 */
public function handle($request, Closure $next)            
    {            
            $response = $next($request);

            $response->header('Cache-Control','nocache, no-store, max-age=0, must-revalidate')
            ->header('Pragma','no-cache') 
            ->header('Expires','Sat, 01 Jan 1990 00:00:00 GMT');

            return $response;
    }
}

I have registered the middleware in app/http/kernel.php

protected $routeMiddleware = [
    'auth' => 'App\Http\Middleware\Authenticate',
    'auth.basic' => 'Illuminate\Auth\Middleware\AuthenticateWithBasicAuth',
    'guest' => 'App\Http\Middleware\RedirectIfAuthenticated',
    'validateback' => 'App\Http\Middleware\ValidateBackButton',
];

I am using the middleware in my controller:

public function __construct()
{
    $this->middleware('auth');
    $this->middleware('validateback');
}

Everything seems fine, however, i get the following error message:

BadMethodCallException in View.php line 387:

Method [header] does not exist on view.

Kindly help me out!



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

Write function in laravel which needs to execute before any controller

Hi i am doing a website in laravel. I am trying to do like a function that needs to execute before any controller.

Example : I have function like

function xyz(){
    //do code here
}

This function need to execute when user on site by refreshing page or doing some ajax requst.

I am aware with the codeigniter there is a way to do this using hook

$hook['pre_controller'] = array(
        'class'    => 'MyClass',
        'function' => 'Myfunction',
        'filename' => 'Myclass.php',
        'filepath' => 'hooks',
        'params'   => array('beer', 'wine', 'snacks')
);

What is the way in laravel to do this ?



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

Database doesn't exist when php artisan migrate

I migrated my local laravel 5 project onto my AWS ec2 lamp Ubuntu server. http://ift.tt/1q8yx0U but it shows

InvalidArgumentException in SQLiteConnector.php line 34: Database does not exist.

I have the database.php set for sqlite

'default' => 'sqlite',
'connections' => [
    'sqlite' => [
    'driver'   => 'sqlite',
    'database' =>  storage_path().'/database.sqlite',
    'prefix'   => '',
],

I have my .env file as

 APP_ENV=local
 APP_DEBUG=true
 APP_KEY=mykeystring
 DB_CONNECTION=sqlite
 CACHE_DRIVER=file
 SESSION_DRIVER=file

I created the database.sqlite file in the storage directory and gave it 777 permissions

when i run

 php artisan migrate

i get the error

 [InvalidArgumentException]
  Database does not exist.



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

Working with Paypal cancel_return

I'm doing my project with laravel 5 and here I have to do payment with paypal. I got this code and doing well with my payments. But when someone goto paypal and if he return without doing payment cancel_return works.It's fine. But I don't know how to handle the $_GET when return Here is my route also

Route::get('/paypal/cancel','Paypal\PaypalController@paypalCancel');

I'm using this code to move to paypal page with my sandbox account.

form action="http://ift.tt/xpRUtH" method="post" id="paypal">

        <input type="hidden" name="cmd" value="_xclick" />
        <input type="hidden" name="cbt" value="Return to example" />
        <input type="hidden" name="business" value="xxx@gmail.com" />
        <input type="hidden" name="item_name" value="{{$data['p_name']}}" />
        <input type="hidden" name="amount" value="{{$data['tot']}}">
        <input type="hidden" name="button_subtype" value="services" />
        <input type="hidden" name="no_shipping" value="0">
        <input type="hidden" name="return" value="{{url('/paypal/return')}}" />
        <input type="hidden" name="notify_url" value="{{url('/paypal/notify')}}"/>
        <input type="hidden" name="cancel_return" value="{{url('/paypal/cancel')}}" />
        <input type="hidden" name="currency_code" value="USD"/>
        <input type="hidden" name="image_url" value="" />
        <input type="hidden" id="custom" name="custom" value="{{$data['id']}}"/>
        <input type="hidden" class="btn btn-primary" style="width:100%" alt="PayPal - The safer, easier way to pay online!"/>

    </form>

Just tell me what should I have do when user cancel his payment in paypal login and return..Thanks..



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

jeudi 31 mars 2016

Validate whether multiple fields are unique simultaneously in laravel 5

This my request class rules.

        'eventDate' => 'required|date|after:yesterday',
        'venue' => 'required',
        'time' => 'required',

I want to validate a rule like below.

        'eventDate' && 'venue' && 'time' => 'unique'

There I need to check if there any row without same eventDate, venue and time altogether. Anyone knows how to declare such a rule?



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