rene

rene

Member Since 4 Years Ago

Experience Points 8,875
Experience Level 2

1,125 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed 0
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • start-engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

11 Aug
1 month ago

rene started a new conversation Homestead Memory Limit

Hello, Where can I add something in my Homestead.yaml which can set the memory limit to a specific value?

13 Sep
1 year ago

rene started a new conversation WhereJsonContains Not Working With My Arrays In PostgreSQL?

I have the following JSON stored in the 'options'-column of my 'Users' table:

{"foobar":[96,11,271,256],"sheep":[80,111]}

How can I show all users that have value 96 in the foobar array of the JSON?

\App\User::whereJsonContains('options->foobar', 96)->get();

I'm using postgreSQL.

28 Jan
1 year ago

rene started a new conversation Free 2FA Services (TwoFactorAuthentication)?

Hi, I can't find any info about 2FA in combination with pricings. What services are free? I found out that the lovely Authy.com costs money.. Google Authenticatior; can't find any info about the pricing. What services for 2FA with Laravel are there more?

29 Apr
2 years ago

rene started a new conversation Echo, Not Showing What I'm Listening For

Hi,

I'm having trouble with my Broadcasting.. It's public broadcasting. What am I missing?

<?php

namespace App\Events;

use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class Order implements ShouldBroadcast
{
    use Dispatchable, InteractsWithSockets, SerializesModels;

    public $foobar;

    public function __construct($foobar)
    {
        $this->foobar = $foobar;
    }

    public function broadcastOn()
    {
        return new Channel('channel-orders');
    }
}

With the following listener:

namespace App\Listeners;

use App\Events\Order;
use Illuminate\Contracts\Queue\ShouldQueue;

class OrderListener implements ShouldQueue
{
    
    public function __construct()
    {
        //
    }
  
    public function handle(Order $event)
    {
        return $event->foobar;
    }
}

And the following js:

import Echo from "laravel-echo";

window.Echo = new Echo({
    broadcaster: 'socket.io',
    host: window.location.hostname + ':6001'
});

window.Echo.channel('channel-orders')
    .listen('Order', (e) => {
        console.info(e);
        alert('newOrder');
        console.log(e.number);
    });

And of course I have started laravel-echo-server start with this in my view: <script src="//{{ Request::getHost() }}:6001/socket.io/socket.io.js"></script>

This is what is logged:

[2017-04-29 23:46:35] local.INFO: Broadcasting [App\Events\Order] on channels [channel-orders] with payload:
{
    "foobar": 87,
    "socket": null
}  ```
25 Apr
2 years ago

rene left a reply on Modify Value Of Request When Request->get('name')

No, not only to database. In all request inside the application.

rene started a new conversation Modify Value Of Request When Request->get('name')

Hello,

Every time I'm doing the following for all request where it occurs:

$data = $request->all();
$data['name'] = ucfirst($data['name');

But isn't there a way that catches al requests() and does the modification for me in all requests? I always call the input name that needs to be transformed..

It's btw an example, I use a different kind of function but this example makes it easier to explain what I'm looking for.

01 Apr
2 years ago

rene left a reply on Nested Resource Routes Protection?

Nevermind, you down know what resource routes are.

31 Mar
2 years ago

rene left a reply on Nested Resource Routes Protection?

Yes, that's correct. That's already happening.

I want some extra checks, to see if resident 4 belongs to user 5 and that one belongs to building 1.

So this shouldn't work: /buildings/9/users/3/residents/4/edit

Because resident 4 is from user 5 and building 1.

Now this works, because the controller returns all models as seperated bindings.

And then I wanna check if the current user = 5 for example and that he can edit resident 4, because it's connected to him.

rene left a reply on Nested Resource Routes Protection?

Yea, I thought of making 3 different Middlewares, for each Resource route, but I can't figure out how to "get" the Models that are binded in the URL.

rene started a new conversation Nested Resource Routes Protection?

Hi,

I have an application with this resource routes:

    Route::resource('buildings', 'BuildingsController');
    Route::resource('buildings.users', 'BuildingsUsersController');
    Route::resource('buildings.users.residents', 'BuildingsUsersResidentsController');

What generates URLs like this: buildings/{building}/users/{user}/residents/{resident}/edit

Now - without the Middleware I'm trying to figure out - every user can change the integers in the URL and get the information.

But what I want to have is the following:

  • User only can access Buildings he is assigned too in the database
  • User only can show his Residents of the Building he is assigned at

How? I can't figure this out.

For people who don't know what nested resource routes are, a controller looks like this:

class BuildingsUsersResidentsController extends Controller
{
    public function index(Building $building, User $user, Resident $resident)
    { 
       //  
    }
18 Mar
2 years ago

rene left a reply on ConvertEmptyStringsToNull Not Working With Vue

Thanks @clay, but why to add it like this?

17 Mar
2 years ago

rene started a new conversation ConvertEmptyStringsToNull Not Working With Vue

Hi, In L5.4 there is

\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,

But it doesn't work with Vue.

I have this Form.js class from VueCasts (https://github.com/laracasts/Vue-Forms/blob/master/public/js/app.js).

I have this: <input type="text" v-model="foo.website"> I have validation that website has to be a valid url, but not required. But it always send an empty string, so it tells me the given value is invalid.

This is what ConvertEmptyStringsToNull should come in, right? I don't get it to work with Vue.

01 Mar
2 years ago

rene started a new conversation 5.4 Error "No Hint Path Defined For [mail]."

Hi, Whats different for 5.4 mails now? Mailables.. but thats lots of work to change for all in all projects. This really simple example doesnt work anymore since upgraded..

The docs are not clear anymore about email.. just refering to mailables and markdown.. I have my emails all in html..

This Function:

public function contact(Request $request)
    {
        $this->validate($request, [
            'name'    => 'required',
            'email'   => 'required|email|max:255',
            'content' => 'required',
        ]);

        $data = $request->all();
        Mail::send(['html' => 'emails.contact'], $data, function ($m) use ($data) {
            $m->from($data['email'], $data['name']);
            $m->cc($data['email'], $data['name']);
            $m->to(config('mail.from.address'), config('mail.from.name'));
        });

        return redirect()->back()->with('success', 'Done');
    }

With this view:

@component('mail::message')


<p>{{ $name }} ({{ $email }} {{ $phone }})</p>

<p><i>
{!! nl2br($content) !!}
</i></p>


@endcomponent

22 Jan
2 years ago

rene started a new conversation PostgreSQL Date_trunc Function

Hi,

Foobar::whereBetween('date', [\Carbon\Carbon::parse($this->birthday)->format("Y-m-d"), \Carbon\Carbon::parse($this->birthday)->addYears(50)->format("Y-m-d")])
   ->whereRaw("CAST(date AS DATE)")
   ->whereRaw("date_trunc('month', date) == " . $this->birthday->format('m'))
   ->whereRaw("date_trunc('day', date) == " . $this->birthday->format('d'))
   ->get();

I wanna have a result of all dates in a range from birthday to 50 years later. That works, but I only want a query when the day and month is the birthday. So I thought about the date_trunc function, but that's not working.

It gives this error:

SQLSTATE[42804]: Datatype mismatch: 7 ERROR: argument of AND must be type boolean, not type date
LINE 1: ...foobars" where "date" between $1 and $2 and CAST(date AS DA...
^ (SQL: select * from "foobars" where "date" between 1951-01-02 and 2055-01-02 and CAST(date AS DATE) and date_trunc('month', date) == 01 and date_trunc('day', date) == 02)

Not that's not MySQL, but Postgresql!

27 Nov
2 years ago

rene started a new conversation Vagrant Provision Keeps Rebooting Nginx..

Hi,

I'm doing a Vagrant provision and it keeps restarting Nginx for no reason... New added site is never added.

==> default: Checking for host entries
==> default: Running provisioner: shell...
    default: Running: inline script
==> default: ssh-rsa AAAAB3NzaC1yc2EAAAADAQ...
==> default: Running provisioner: shell...
    default: Running: inline script
==> default: Running provisioner: shell...
    default: Running: inline script
==> default: Running provisioner: shell...
    default: Running: inline script
==> default:  * Restarting nginx nginx
==> default:    ...done.
==> default: php5-fpm stop/waiting
==> default: php5-fpm start/running, process 3800
==> default: Running provisioner: shell...
    default: Running: inline script
==> default:  * Restarting nginx nginx
==> default:    ...done.
==> default: php5-fpm stop/waiting
==> default: php5-fpm start/running, process 3850
==> default: Running provisioner: shell...
    default: Running: inline script
==> default:  * Restarting nginx nginx
==> default:    ...done.
==> default: php5-fpm stop/waiting
==> default: php5-fpm start/running, process 3900
==> default: Running provisioner: shell...
    default: Running: inline script
==> default:  * Restarting nginx nginx
==> default:    ...done.
==> default: php5-fpm stop/waiting
==> default: php5-fpm start/running, process 3950
==> default: Running provisioner: shell...
01 Nov
2 years ago

rene left a reply on Query() Not Working When Doing It On Auth()->user()->cars()

@InaniELHoussain what part is not clear in the main post? then i'll change it

rene left a reply on Query() Not Working When Doing It On Auth()->user()->cars()

@bobbybouwmann yea, tried that too. this was for the example (changed it now), but still it thinks that i search for every car with that user_id OR with OR with.. so it'll be always the full list of all cars of the user

rene started a new conversation Query() Not Working When Doing It On Auth()->user()->cars()

Hi,

I'm doing this now for my postgresql database:

$cars = App\Car::query();
$cars->where('user_id', auth()->user()->id); # But this causes trouble...
foreach ($criteria as $word) {
    $cars->orWhere('specification', 'ILIKE', '%' . trim($word));
    $cars->orWhere('specification', 'ILIKE', trim($word) . '%');
    $cars->orWhere('specification', 'ILIKE', '%' . trim($word) . '%');
}
$cars->get();

This line causes trouble: $cars->where('user_id', auth()->user()->id); because it overwrites the other Where-statements. And doing this does not work, because it says "query()" does not exists.: $cars =auth()->user()->cars()->query();

Now I quick fix it with doing a foreach-loop checking if the $car->user_id is the same as auth()->user()->id and make a new collection, but that's ugly en slow :')

14 Oct
2 years ago

rene started a new conversation Mail AttachData Of PDF Breaks Html Styling

Hi,

This is my code:

$pdf = PDF::loadView('pdf.invoice', ['invoice' => $invoice]);
       Mail::send('emails.invoice', $data, function ($m) use ($user, $pdf, $data) {
            $m->to($user->email, $user->full_name)->subject($data['title']);
            $m->attachData($pdf->output(), $order->invoice_number.'.pdf',  ['Content-Type' => 'application/pdf']);
        });

This does attaches the PDF in the correct way, but the e-mail itself misses the styling.

This is the source of the email itself: http://pastebin.com/VVFc7Qfz

What's going wrong?

07 Sep
3 years ago

rene started a new conversation Where('field', Null) Is Not Working

Hi,

The following query results in zero results:

$request->get('foobar') returns a null.

Foobar::where('user_id', 1)->where('second_id', $request->get('foobar'))->first();

This is possible, because the second_id may contain null-values. But it doesn't work. It's not recognizing the second_id. It gives zero results.

08 Aug
3 years ago

rene left a reply on Unique List, Show One Of Value In Fields

Model: Foobar (table: foobars) has the fields user_id, color, field_a, field_b. User hasMany Foobar.

Output is:

  • Blue, title
  • Red, other title
  • Pink, other title
  • Blue, other title
  • Orange, other title

In the list above I have twice "blue", what I want is to remove duplicates. The first in the list should be kept.

rene started a new conversation Unique List, Show One Of Value In Fields

Hi,

There is a field color that I wanna show only once for each color inside. So I thought of a GroupBy, but that's not working. Neither is distinct.

return auth()->user()->foobars()->with(['items'])->orderBy('created_at', 'desc')->get();

How to do this?

12 Jul
3 years ago

rene left a reply on Overwriting PostLogin Not Working In 5.2?

@Prullenbak my fault, i'm on 5.2, but it did the trick when targeting login() isntead of postlogin()

rene started a new conversation Overwriting PostLogin Not Working In 5.2?

Hi,

I tried almost whole Google. but can't figure out how to overwrite the PostLogin function. What I want is to check if a user has status field in the user tale to true.

class AuthController extends Controller
{
    use AuthenticatesAndRegistersUsers, ThrottlesLogins;

  public function postLogin(Request $request)
    {
        // dd($request); # even  a DD() won't work
        $this->validate($request, [
            'email' => 'required|email', 'password' => 'required',
        ]);
        if ($this->auth->validate(['email' => $request->email, 'password' => $request->password, 'status' => 1])) { // see here, status 
            return redirect($this->loginPath())
                ->withInput($request->only('email', 'remember'))
                ->withErrors('Your account is Inactive or not verified');
        }
        $credentials  = array('email' => $request->email, 'password' => $request->password);
        if ($this->auth->attempt($credentials, $request->has('remember'))){
                return redirect()->intended($this->redirectPath());
        }
        return redirect($this->loginPath())
            ->withInput($request->only('email', 'remember'))
            ->withErrors([
                'email' => 'Incorrect email address or password',
            ]);
    }
30 Jun
3 years ago

rene left a reply on Dispatch Job In Listener?

I added use Illuminate\Foundation\Bus\DispatchesJobs; to my listener and added use DispatchesJobs > returned 500

rene started a new conversation Dispatch Job In Listener?

Hi, I have a Job that I wanna dispatch. In my Controllers I do this: $this->dispatch(new \App\Jobs\Foobar($user));

But now I want a Job to be fired on the end of a Listener... But that doesn't work the same as in the Controller. How can I make it work inside a Listener?

26 Jun
3 years ago

rene left a reply on Laravel 5.3 Wish List

ability to make cashier more extensible with other payment providers like www.mollie.com

14 May
3 years ago

rene left a reply on 5.1 Logged In When Going Incognito As Current Chrome User

There is something strange going on, because it also happens something a new visitor is logged in as a random user. Maybe I did something incorrect with Socialite?

This is my Auth controller:

<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ThrottlesLogins;
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;

use App\User;
use App\Social;

use Auth;
use Queue;
use Socialite;
use Validator;

use Session;
use Cookie;
use Mail;
use Carbon\Carbon;

class AuthController extends Controller
{

    use AuthenticatesAndRegistersUsers, ThrottlesLogins;

    protected $redirectPath = '/hello-world';

     /**
     * @var AppMailer
     */
    private $mailer;

    /**
     * Create a new authentication controller instance.
     *
     * @return void
     */
    public function __construct(AppMailer $mailer)
    {
        $this->middleware('guest', ['except' => ['getLogout']]);
    }

    /**
     * Redirect the user to the Socialite authentication page.
     *
     * @return Response
     */
    public function redirectToProvider(\Illuminate\Http\Request $request, $socialite)
    {
        return Socialite::driver($socialite)->redirect();
    }

    /**
     * Obtain the user information from Socialite.
     *
     * @return Response
     */
    public function handleProviderCallback($socialite)
    {
        $user = Socialite::driver($socialite)->user();
        $authUser = $this->findOrCreateUser($user, $socialite);

        Auth::login($authUser, true);
        $this->registerLastLogin();

        return redirect()->intended('dashboard');
    }

    private function findOrCreateUser($provider, $socialite)
    {
        if ($authUser = Social::whereSecret($provider->id)->first()) {
            return User::findOrFail($authUser->user_id);
        }

        if($user = User::whereEmail($provider->email)->first())
        {
            $user = $user;
        }
        else
        {
            $user = User::create([
                'name' => $provider->name,
                'email' => $provider->email,
                'password' => bcrypt(str_random(60)),
            ]);
        }

        $social = Social::create([
            'user_id' => $user->id,
            'secret' => $provider->id,
            'provider' => $socialite,
        ]);

        $user->validations()->create(['type' => $socialite]);

        return $user;
    }


    /**
     * Get a validator for an incoming registration request.
     *
     * @param  array  $data
     * @return \Illuminate\Contracts\Validation\Validator
     */
    protected function validator(array $data)
    {
        return Validator::make($data, [
            'name' => 'required|max:255',
            'email' => 'required|email|unique:users',
            'password' => 'required|min:8',
        ]);
    }

    /**
     * Create a new user instance after a valid registration.
     *
     * @param  array  $data
     * @return User
     */
    protected function create(array $data)
    {
        return User::create($data);
    }

    /**
     * Handle an authentication attempt.
     *
     * @return Response
     */
    public function authenticateLogin(\Illuminate\Http\Request $request)
    {
        $this->validate($request, [
            'email' => 'required|email',
            'password' => 'required',
        ]);
        if (Auth::attempt(['email' => $request->get('email'), 'password' => $request->get('password')], @$request->get('remember')))
        {
            return $request->session()->get('url.intended');
        }
        return abort(403);
    }

}


get('auth/logout', 'Auth\[email protected]');
post('auth/authenticate', 'Auth\[email protected]');
get('auth/{socialite}', ['uses' => 'Auth\[email protected]', 'as' => 'socialite']);
get('auth/{socialite}/callback', 'Auth\[email protected]');

rene started a new conversation 5.1 Logged In When Going Incognito As Current Chrome User

For one specific Laravel project with nothing strange changed on the Auth part it keeps happening that when I login in Chrome, and open an incognito browser in Chrome: I'm still logged in as the user via the non-incognito window. What can it be? I have session driver set to all settings, didnt' help.

09 May
3 years ago

rene started a new conversation Cookie Sharing Two L5 Sites

Hello, I have two website URLs that use the same database for the Users, but now people have to login for both separately. Is there a way to prevent that from happening? So loggin in for site A also makes you loggedin for site B?

27 Mar
3 years ago

rene started a new conversation Get AVG From HasMany Relation Field?

Hello,

I have an integer stored in my database, where I want the average value from.

class Foobar extends Model
{
    protected $appends = ['rating'];
    public function getRatingAttribute()
    {
        return $this->hasMany(Review::class)->avg('rating');

      /// return $this->reviews()->avg('rating'); // this also doesn't work
    }
}

For some reason it's null, so probably it's not correct what I'm trying to do.

23 Mar
3 years ago

rene left a reply on Order Nested Subquery ->with([])

@prez did that, not working. im on L5.1. maybe its possible from 5.2?

rene left a reply on Order Nested Subquery ->with([])

@prez yes to make more clear that part of code was needed, thought it wasnt. by no, that solution didnt help either. too bad :(

rene left a reply on Order Nested Subquery ->with([])

No @Prez, not possible. Because of the sub-select

rene started a new conversation Order Nested Subquery ->with([])

I have a Foobar list of lots of items that I wanna have ordered by the field "xx".

<?php

Foobar::with(['user', 'comments.user', 'listing' => function($q)  {
        $lat = 45.0000001;
        $lng = 20.0000001;

        $q->select(
            DB::raw('
               ////// ....
                AS xx'
            )
        )
        ->orderBy('xx'); // order by this
}, 'cars']) 
->paginate(20);

But it still orders the default way, Foobar by ID desc. How to fix this?

09 Mar
3 years ago

rene left a reply on Package For Searching In Range Of Lat-lng

@ohffs found that one indeed, but that didn't made it possible to search within a given range - and I'm using MySQL

rene started a new conversation Package For Searching In Range Of Lat-lng

I have some Locations stored with Latitude and Longitude and I wanna get a result of some locations within range of some posted lat-lng values.

So something like: I'm at location x (lat-lng) and I wanna search for all Locations within a range of 10 kilometers of my location.

Is there a php/laravel package for this? I don't know what to search for.

06 Mar
3 years ago

rene started a new conversation Policy For Related User_id ?

How can I make a Policy/Gate for the following situation:

Conversations

  • user_id
  • car_id
  • message

Cars

  • user_id

The Conversation can be accessed when authenticated user is the "user_id" in the Conversation OR when the auth user is the related user_id via the car_id

I have now this...

public function show(Conversation $conversation, Request $request)
    {
        $this->checkAccess($conversation, $request);
return $conversation;
    }

private function checkAccess(Conversation $conversation, Request $request)
    {
        if($request->user()->role_id == 1){
            $can = ($request->user()->id === $conversation->user_id);
        }
        else {
            $can = ($request->user()->id === $conversation->car->user_id);
        }
        if(!$can){
            return abort(403);
        }
    }
25 Feb
3 years ago

rene left a reply on WhereLike Is Case-sensitive?

@willvincent thnx !! that was it :))

rene started a new conversation WhereLike Is Case-sensitive?

Hi,

I have this query I'm running Eloquent on my PostgreSQL database:

$searcher = ['filled', 'array', 'list'];
$list = Product::query();
            foreach($searcher as $word){
                $list->where('title', 'LIKE', '%'.$word.'%');
                $list->orWhere('name', 'LIKE', '%'.$word.'%');
            }
            $list ->orderBy('title')->get();

But I have the problem that for some reason the where Like is case-sensitive.

For example I have this in the Database: "Hello Foobar". If I search for "foobar" it doesn't find it, if I use a capital F it does.

How to fix this?

rene started a new conversation AngularJS Request Header Checker

I'm setting a header like this in Angular:

$http.defaults.headers.common['Test'] = 'Foobar';

But how can I check in my Laravel Request if header is present? In every request. With a Middleware of course, but I can't find the "test" request parameters, so neither the value to check..

23 Feb
3 years ago

rene started a new conversation Auth On Lumen 5.2 For APIs Videolesson-request

Since Lumen 5.2 focusses on API's I think it's great to know how to secure this best. Probably with default Auth, but how to pass authentication with API-request.

15 Feb
3 years ago

rene started a new conversation Re-auth Package

Hi, a little while ago i came across a package for laravle 5 that implemented an extra security layer. It was some kind of middleware that you can add to a route, that forces you to re-enter your password after already being logged in to the app. But can't find it anywhere.. Who know what package i looked at?

16 Jan
3 years ago

rene started a new conversation WhereIn Doesnt Work With Passing Array

How to pass through an array in the whereIn?

I have this:

$query->whereIn('id', $list);

Where $list is:

[2016-01-16 16:40:38] local.INFO: array (
  0 => 8,
  1 => 7,
  2 => 5,
)  

That doesn't work, but when I hardcode it like this it works:

$query->whereIn('id', [8,7,5]);

Why is this?

rene started a new conversation WhereHas With BelongsToMany Not Working

Not active forum

04 Jan
3 years ago

rene started a new conversation Eloquents $visible Attribute Also For $with Attribute

Hello,

I have this Model:

class Foobar extends Model {
    protected $visible = ['id'];

    protected $with = ['sheep'];

    public function sheep()
    {
        return $this->hasOne('App\Sheep');
    }

}

What it does now because of the "visible", is that it shows only the ID. But I wanna choose some fields from Sheep too in that visible part. So I thought: protected $with = ['id', 'sheep.breed']; but thats not working.

Thing I can do is also add $visible to the Sheep class but that's not prefered, because if I call Sheep on it's own all things should be visible.

Is what I want possbile?

08 Dec
3 years ago

rene started a new conversation Help With Ordering On With-query Eloquent

Hi, I have this (fake names over here):

return App\Car::has('info.build')->with(['brand', 'info.build' => function($q){
    $q->orderBy('date', 'desc');
}])->get();

But it doesn't sort the Cars desc. based on the date of the 'info.build'-subquery. What am I doin' wrong?

07 Dec
3 years ago

rene started a new conversation What Event Is Being Called For Each Re-visiting Auth-user?

Hello, I wanna store the last_login in the Users table, so I have a listener on the auth.login event, but that event is only triggered when:

  • Someone logs in

The event I'm looking for is:

  • User is loggedin, via remember cookie
  • Leaves site
  • Comes back on site after a while
  • Is still loggedin
  • Update the Last_login value with current timestamp

Via Event, but what event is triggering this?

rene left a reply on Function That Checks Auth-Check

@danielbaylis not working.. when i visit the website after a while in the same browser, it isn't triggered.