Elfinder Laravel Private folder ?

I Would like to know if anyone could help me.
I use Elfinder Laravel : https://github.com/barryvdh/laravel-elfinder

And I try to make some folder private, I mean all my user had an company and a role in this company for example :

company : XXX role: YYY

path : CompanyName/UserRole

I would like only people in the same company & role could view this folder, people from the same company but not with the same role can’t see the role YYY folder, people from other company couldn’t see the folder CompanyName.

I don’t know if I was clear

I have already tried to change the dir config according to the user / company / role connected but nothing does.

How to check if there are values in a table in the database in CodeIgniter

I’m creating a project where in I want to verify if there is a data that has been inserted in a table by a certain user and display it if there’s any. I’m fairly new to CodeIgniter and I’m unsure of how to display all the lists that has been by a certain user if it is logged in.

This is what I have in my model so far:

 public function get_all_lists($user_id){
            $this->db->where('list_creator_id', $user_id);
            $query = $this->db->get('lists');

            return $query->result();    

This is what I have on my view:

<li class="list-group-item">
                <a href="<?php echo base_url();?>project_controllers/lists/create" class="btn btn-success pull-right">
                    Create a List
                <h3 align="center">
                    <a href="<?php echo base_url();?>project_controllers/lists/display/<?php echo $list->id;?>">
                        <?php echo $list->list_name; ?>
        <?php endforeach; ?>

And this is what I have on my controller:

public function index(){
        $user_id = $this->session->userdata('user_id');

        $data['lists'] = $this->lists_model->get_all_lists($user_id);

        $data['main_view'] = "project_views/lists/index";

        $this->load->view('project_views/layouts/main', $data);

My goal here is to display all the lists that has been created by a certain user if it is logged in. If the user has been logged in and has not created any list, I want a message that says, “You don’t have created any lists yet”.

APNS notification using swift

iOS 11.x Swift 4.0

Yes, I know there a dozens solutions out there that will send push notifications for you, but I am looking to create a native solution.

Now I managed to put some PHP code together that works, within it I construct a APNS payload and then pack it’s way off to Apple, which of course sends it to my client. It is only 10 lines of code, but now I need to convert it to Swift.

"aps": {
"title": "Yo",
"body":"Stay Cool" },
"sound": "default"
"misc": "tag"

$apnsHost = 'gateway.push.apple.com';
$apnsPort = 2195;
$apnsCert = 'apns-dev.pem';
$deviceToken = '7effd4dfc158d922c867c1e3c99fd46296e2b1afcd080a63a2da398bce1c9bb3';
$apnsHost = 'gateway.sandbox.push.apple.com';
$apnsPort = 2195;
$apnsCert = 'apns-dev.pem';
$streamContext = stream_context_create();
stream_context_set_option($streamContext, 'ssl', 'local_cert', $apnsCert);
$apns = stream_socket_client('ssl://' . $apnsHost . ':' . $apnsPort, $error,   $errorString, 2, STREAM_CLIENT_CONNECT, $streamContext);
echo $error;
$apnsMessage = chr(0) . chr(0) . chr(32) . pack('H*', str_replace(' ', '',     $deviceToken)) . chr(0) . chr(strlen($payload)) . $payload;
fwrite($apns, $apnsMessage);

I find this answer on SO which looks like my man, but no … there is no certificate [.pem] on this is there?

How should Secure Transport TLS be used with BSD sockets in Swift?

I am out my depth right now? Any help/pointers to the right path desperately needed?

Laravel Eloquent join table realtionships

I went through multiple examples and previous posts here, but I can’t find what I am doing wrong. I have two tables:


id    username
1     test1
2     test2
3     test3

Scores table

id    user_id    points
1     1          52
2     2          62
3     3          12

And now I want to get all scores and replace user_id with actual username. Here is my code:



namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Score;
use App\Http\Resources\Score as ScoreResource;

class ScoresController extends Controller
    public function index()
        $scores = Score::with('user')->paginate(4);

        return ScoreResource::collection($scores);



namespace App;

use Illuminate\Database\Eloquent\Model;
use App\User;

class Score extends Model
    public function user(){
        return $this->belongsTo(User::class,'user_id');



namespace App;

use Laravel\Passport\HasApiTokens;
use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
use App\Score;

class User extends Authenticatable
    use HasApiTokens, Notifiable;

    protected $fillable = [
        'username', 'email', 'password', 'avatar'

    protected $hidden = [
        'password', 'remember_token',

    public function scores(){
        return $this->hasMany(Score::class,'user_id');

And Score resource


namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class Score extends JsonResource
    public function toArray($request)
        return [
            'username' => $this->user_id,
            'points' => $this->points,

At the moment I am showing user_id and points, I tried with

$this->username OR $this->user-id->username

but none of them works and I know I could use DB or raw SQL, but I want to do it this way