vendredi 2 octobre 2015

Eloquent: firstorCreate() does not work with postgresSQL's JSON type

I am getting the following error:

Undefined function: 7 ERROR: operator does not exist: json = unknown

As 2 of my columns are of type JSON.

The code which throwing error is:

$this->firstOrCreate($records);



via Chebli Mohamed

Laravel 5.1 - Variable in main blade layout

I'm using Laravel 5.1. And I have a problem about variable in my Layout View.

In my Layout view, I use a variable to show an active login user like this one on my DashboardController:

...
class DashboardController extends Controller {

        public function index(Request $request) {
            //
            $title = "Dashboard";
            $userActive = $request->user();
            return view('dashboard.index', compact('title', 'userActive'));
        }
...

The $userActive is to show who is login. My problem is i need to write this (the $userActive) code like above if I use another function, or another Contoller.

How to make it simple by write it only once?



via Chebli Mohamed

Laravel remembering users

I didn't touch anything in the Laravel's registration, I just implemented basic login/register functionality and I created a route to activate users by email, like so. But I couldn't find how to login a user with remember me functionality after activated his account.

My route

Route::get('auth/activate/{token}', 'Auth\PasswordController@activate');

PasswordController

public function activate($token) {
    //get token value.
    // find the user that belongs to that token.
    $activation = User::where("confirmation_code", $token)->get()->first();
    // activate user account
    $activation->confirmed = 1;
    $activation->save();
    Auth::loginUsingId($activation->id); // User is logged in now.
    return view("frontend.feed.index");
}



via Chebli Mohamed

How does Eloquent's create()/fill work()?

I trying to set records in a row by doing this in my Model:

protected $fillable = ['completeness','task'];
    public  function add($records) {
        $this->create($records);
        $this->save();
    }

Though all values are there yet I am getting this:

QLSTATE[23502]: Not null violation: 7 ERROR: null value in column "user_id" violates not-null constraint DETAIL: Failing row contains (5, 120, null, very detailed, null, null, null, null, null, null, 2015-10-02 07:12:05, 2015-10-02 07:12:05).

How does create() or fill() work?



via Chebli Mohamed

jeudi 1 octobre 2015

Using third party templates in Laravel

How do you manage third party templates such as themeforest templates in Laravel? Where do you store in view and how to manage it under source controls.



via Chebli Mohamed

How to Integrate Paypal Payment gateway in laravel?

How to Integrate Paypal Payment gateway in Laravel? I tried this http://ift.tt/1LSrmRI but config have some problem,Please anybody say some ideas



via Chebli Mohamed

Setting multiple queue name in Laravel5.1

This is my first time using Laravel5.1 Queue. I already set it up and it worked fine. But when i tried using here ->onQueue('adding_something'), Below is my code in dispatching the job

$command = (new SendInvitation($pricelist_id, $user_id, $cronType, $status, $version, $company_id))->onQueue('add_something')->delay(360);

$this->dispatch($command);

after this the jobs stop working. Now they dont get process at all. :(. On my config/queue.php, i tried updating the queue section to

'queue' => 'add_something,default'

Also tried restarting the php artisan queue:restart but still it doesnt work.



via Chebli Mohamed