SiNi_Si

SiNi_Si

Member Since 10 Months Ago

Experience Points 22,630
Experience Level 5

2,370 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 207
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.

05 May
2 months ago

SiNi_Si left a reply on Are There Any Video For 2 Step Login Checks?

When I say 2 step, I’m talking about if someone logs in from a new computer the must repost to a text send.

SiNi_Si started a new conversation Are There Any Video For 2 Step Login Checks?

Are there any video for 2 step login checks? Is this difficult with the auth scaffolding?

Thanks Si

14 Mar
4 months ago

SiNi_Si left a reply on Changing Jason Data

Sorry I have solved it

chart.data.datasets[0].data = data.Guest_data; chart.data.datasets[1].data = data.Member_data;

SiNi_Si started a new conversation Changing Jason Data

Hi, I have a chart for live users on the site and use Ajax to get my live cached users. All Works great but I have a newbee Javascript question

I can change the lables through - chart.data.labels

How can I get to each data set's data? I need to update K_Guest_data and K_Member_data. [code] setInterval( GetUsers, 10000 ); function GetUsers(){ var ctx = document.getElementById('MyPageChart').getContext('2d'); var chart = new Chart(ctx, { type: 'bar', data: { type: 'bar', labels: K_Lable_data, datasets: [{ label: 'Guest', borderColor: 'rgba(190, 82, 75, 1)', backgroundColor: 'rgba(190, 82, 75, 0.1)', borderWidth: 1, data: K_Guest_data }, { label: 'Member', borderColor: 'rgba(75, 190, 83, 1)', backgroundColor: 'rgba(75, 190, 83, 0.1)', borderWidth: 1, data: K_Member_data }] }, options: { .... } } });

$.ajaxSetup({
    headers: {
        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
    }
});
$.ajax({
    data: '',
    type: 'POST',
    url:"{{ url('/Admin/Ajax') }}",
    cache: false,
    contentType: false,
    processData: false,
    dataType:'JSON',
    success: function(data) {
        chart.data.labels = data.Lable_data;
        chart.data.datasets.data = data.K_Guest_data;
        //chart.data.datasets.data = data.K_Member_data;
        chart.update();
    },
    error: function(data) {
        $.notify("Bad Request Ajax", "RPC_BAD");
    }
});

} [/code]

Thanks

10 Mar
4 months ago

SiNi_Si started a new conversation I'm Thinking Of Using Redis Do I Need A Make A Webhook And Restart Redis Server?

Is this a good practise? or is it good to go after it is installed on the server?

Also is this a good choice for just caching?

Thanks Si

01 Feb
5 months ago

SiNi_Si left a reply on View Image From Storage In Blade

Thanks for your help.

The problem was that some how I had broken my simlink to my storage directory. So the folder was filed with files, and I didn't notice the simlink was not there.

Thanks

SiNi_Si started a new conversation View Image From Storage In Blade

Im having problems getting an image to show in a blade from the laravel storage. After reading lots of post there looks to be many ways. Unfortunately, I have had no luck.

In my filesysems.php I have added [code] 'avitar' => [ 'driver' => 'local', 'root' => storage_path('app/public/images/users/'), 'url' => env('APP_URL').'/storage', 'visibility' => 'public', ], [/code]

The path is Storage->app->public->images->users->THE IMAGE

I have run php artisan storage:link and get back "The "public/storage" directory already exists."

[code] {{ Storage::disk('avitar')->url('default.png') }}

{{ Storage::disk('public')->url('images/users/default.png') }}

{{ Storage::disk('public')->url('/storage/images/users/default.png') }}

{{ Storage::disk('public')->url('http://127.0.0.1:8000/storage/app/public/images/users/default.png') }}

{{ asset('images/users/default.png') }}

{{ url('images/users/default.png'); }} [/code]

But no luck, Any Idea what I'm doing wrong?

Thanks Si

31 Jan
5 months ago

SiNi_Si left a reply on Uploading Files To Public Storage Simlink

{{ Storage::disk('public')->url('/images/users/3/1343051701.png') }}

SiNi_Si left a reply on Uploading Files To Public Storage Simlink

Sad to say no luck with that

user image

SiNi_Si left a reply on Uploading Files To Public Storage Simlink

still no luck after everyone is saying use url()

@inject('path', 'App\Injection')

{{ url('storage/images/users/'.$path->Avitar_Image()) }}

SiNi_Si left a reply on Uploading Files To Public Storage Simlink

Thats works great for the upload. File is in storage.

how do you get it back in the blade?

I have tried to do some hard code tests but no luck yet {{ asset('storage/users/3/1953263541.png') }} or {{ asset('storage/images/users/3/1953263541.png') }}

Thanks

SiNi_Si started a new conversation Uploading Files To Public Storage Simlink

I'm using ajax to upload images to summernote, and all works fine to the public image directory using...

$image->move(public_path('images/users/'.$id.''), $new_name);

what do I need to change this to, to send this to my simlink storage directory?

I have checked and ran... php artisan storage:link

and it does return... The "public/storage" directory already exists.

Any help would be great thanks Si

08 Dec
7 months ago

SiNi_Si left a reply on Deployments All Good But 505 Error On Site

All fixed with new laravel project and changed gitignore to take the .env file.

SiNi_Si left a reply on Deployments All Good But 505 Error On Site

Every new deploy don't add and .env file. watched all the videos but they look really old and out dated.

Is Envoyer comparable without Forge?

SiNi_Si left a reply on Deployments All Good But 505 Error On Site

I have noticed there is no .env file and have renamed the .env.example to .env

But no luck

SiNi_Si started a new conversation Deployments All Good But 505 Error On Site

Not sure what I missed. I have just used all the default setup in Envoyer but every page has missing images and 505 error.

Deployments are all green and have passed. I don't have my domain transferred yet and have just been viewing site via ip plus path.

http://46.43.14.66/current/public/

Any thoughts?

20 Nov
8 months ago

SiNi_Si left a reply on Can I Use Envoyer With CentOS 7.5?

Thanks, I will give it a go then.

SiNi_Si started a new conversation Can I Use Envoyer With CentOS 7.5?

I have a full managed server and would like to use Envoyer on CentOS 7.5. I can't find anything on the Envoyer site for OS requirements.

Thanks

19 Nov
8 months ago

SiNi_Si started a new conversation Workflow To Fetch Updates From Git To Laravel

Hi, what is the workflow to just getting your updates from githut to laravel local?

I work on 2 computers off and on and use forge to connect to my server.

My updates / push always works well


git add .
git commit -m "first commit"
git push -u

Every time I get my project I have been deleting my project and run clone


Git clone https://github.com/SiNi-Si/SiNi.git
Composer install
Copy .env file over

What do I need to do to just update my local? with pull or merge? I always get error or something will not merge because of conflicts.

Thanks

16 Nov
8 months ago

SiNi_Si left a reply on Forge Not Taking Images

Sorry Solved. It's not Forge paths in laravel are not correct

localhost/public/images/image.jpg

xxx.xxx.xxx.xxx/images/image.jpg

SiNi_Si started a new conversation Forge Not Taking Images

Forge is not updating images when I do a push to github.

Under my Forge control panel I can see all the updates "Deploying Pushed Code" but no images. Is there something that need to be changed in Forge?

I have checked the Github and all the images are there.

Thanks

06 Nov
8 months ago

SiNi_Si started a new conversation Forge Not Adding Full Github Repo

What do you do if forge does not add all the files from your GitHub repo?

I made a AWS server instance and when I add my GitHub repo I just get an defalt env. file and it only take a half a second to add repo to server.

I have a private repo with my vendor directory and env. file due to the laravel braintree problem.

\looks like the only option is try try and add the repo again, but I get a default env. file and a 500 error when I hit the site.

Also on a side note, how would you get other files on the server after deployed? Under AWS there is no instance once forge makes the server.

Thanks

SiNi_Si left a reply on Github Error 500 After Composer Install

It looks like everything must be pushed up to github if you are using laravel and brain tree. It works in the end but not ideal

Si

SiNi_Si left a reply on Github Error 500 After Composer Install

This is something else. If I copy my vendor file over all is good. This has to do with braintree

SiNi_Si left a reply on Github Error 500 After Composer Install

Just like the docs, but this is only new error after the bithub clone


use Laravel\Cashier\Billable;

class User extends Authenticatable { use Billable; }

SiNi_Si left a reply on Github Error 500 After Composer Install

Looks like i'm getting closer

clone from bithub Composer update make a new env. file Php artisan key:gererate composer require "laravel/cashier-braintree":"~2.0"

But this still throws a error for Billable


"syntax error, unexpected 'class' (T_CLASS), expecting function (T_FUNCTION) or const (T_CONST)"

class User extends Authenticatable{ use Billable; }

SiNi_Si started a new conversation Github Error 500 After Composer Install

Hi, I'm running windows 10 and after a github clone, I have to run composer install and get an error 500. I have installed suto for windows and sudo chmod 777 -R storage comes up this a Passphrase: prompt.

Nothing really works for me in the github clone

The only way I can get my project to work again is zip up at my office and unzip from home.

I went through all the git videos https://laracasts.com/series/git-me-some-version-control

But, They don't go over any problems. It just magically works in the videos.

Any incite on the full workflow would be great. Thanks

05 Nov
8 months ago

SiNi_Si left a reply on Looking For Advice Forge And Providers

Great looking forward to the new videos.

As for servers and resources. The are low end 4 cores 8 gig of ram in three locations.

Web server is low traffic. 2 Licence servers with just a database each, and our c++ hits a php page via a encryption php lib to get licence and user login. After they login, it fills a change table that a cron task runs every min to sync all 3 users table on all three servers. Looking at the change tables 70-120 changes per min. This is using 65% resources.

From what I’m reading AWS is a zero down solution and might be able to go to one login server and use the main site as backup.

Thanks for input

SiNi_Si started a new conversation Looking For Advice Forge And Providers

After watching a few video, forge looks really good. But I was a bit concerned that all the videos have been archived. Is this still used as a good tool? Hoping it is.

As for service providers what is the best?

I was looking at AWS, but after going to their site. There is just too many options and not sure what I need for forge.

As for what I have been building is a replacement for my business site and licence server. Between 70-120 hits per min.

Any thoughts or advice would be amazing.

SiNi_Si left a reply on Cashier And Braintree

Thanks!

SiNi_Si started a new conversation Cashier And Braintree

Hi, when adding the braintree to laravel, do I need to run both installs below from composer. Or, do I just run the braintree install. Sorry, the docs are not really clear on this.

composer require laravel/cashier

composer require "laravel/cashier-braintree":"~2.0"

Thanks Si

03 Nov
8 months ago

SiNi_Si left a reply on Get Sum Of Multiple Item To Array In One Call

I just didn't want to make 11 database calls.

here is my old code


$result = mysqli_query($con, "select id, mac1, mac2, password, active, SUM(pPR) AS pPR, SUM(pSI) AS pSI, SUM(pSC) AS pSC, 
        SUM(pUR) AS pUR, SUM(pCO) AS pCO, SUM(pFO) AS pFO, SUM(pIG) AS pIG, SUM(pDE) AS pDE, SUM(p09) AS p09, SUM(p10) AS p10, 
        Use_Mac  
        from disciples where usermail = '$user' AND active = 1 ", MYSQLI_USE_RESULT);

But if this is the way in Laravel. I will stick with it.

Thanks

SiNi_Si started a new conversation Get Sum Of Multiple Item To Array In One Call

Is there a way to get a sum of multiple item to an array?

I would rather clean this up into one call


$Lic_AA = \App\License::where('user_id', $id)->where('active', 1)->sum('AA');
$Lic_IG = \App\License::where('user_id', $id)->where('active', 1)->sum('IG');
$Lic_PR = \App\License::where('user_id', $id)->where('active', 1)->sum('PR');
$Lic_SI = \App\License::where('user_id', $id)->where('active', 1)->sum('SI');
$Lic_DE = \App\License::where('user_id', $id)->where('active', 1)->sum('DE');

Thanks

26 Oct
8 months ago

SiNi_Si left a reply on Getting Data Back To Javascript From Laravel Controller

That was it! The CSRF token has fixed this.

Thanks

SiNi_Si left a reply on Getting Data Back To Javascript From Laravel Controller

244:890 Uncaught ReferenceError: url is not defined at Object.error (244:890) at i (jquery.min.js:2) at Object.fireWith [as rejectWith] (jquery.min.js:2) at z (jquery.min.js:4) at XMLHttpRequest. (jquery.min.js:4)

SiNi_Si left a reply on Getting Data Back To Javascript From Laravel Controller

I have added...


error: function(data) {
        alert(data.url);
 }

I just get back "undefined"

SiNi_Si left a reply on Getting Data Back To Javascript From Laravel Controller

Thanks tykus - nothing gets added to summernote. How can I echo a response to see what i'm getting back?

Thanks RamjithAp - No change on this. I have even added dataType:'JSON',

SiNi_Si started a new conversation Getting Data Back To Javascript From Laravel Controller

I having a hard time getting a response from my laravel controller sent by ajax. I have removed all the auth middleware and hard coded the exact response I need to get back. Still nothing.

Here is the ajax from my old site plain php and worked fine. This would call a php file and would echo back the path and file to insert in summernote.


function sendFile(file, el) {
    var form_data = new FormData();
    form_data.append('file', file);
    $.ajaxSetup({
        headers: {
            'X-CSRF-Token': $('meta[name=_token]').attr('content')
        }
    });
    $.ajax({
        data: form_data,
        type: "POST",
        url:"{{ url('/Upload') }}",
        cache: false,
        contentType: false,
        processData: false,
        success: function(url) {
            $(el).summernote('editor.insertImage', url);
        }
    });
}

here is the post route.


Route::post('/Upload', '[email protected]');

Here is the hard coded response to send back to ajax


public function support(Request $request){
      return '/public/images/test/IMG_1579.jpg';
    }

The ajax sends a file and the controller would upload the file and return its new file name and path in one string to be added to summernote.

Any thoughts would be great Thanks

23 Oct
8 months ago

SiNi_Si left a reply on Get User From User_id From Array Not Collection

This really helped get through this.

Thanks

SiNi_Si left a reply on Get User From User_id From Array Not Collection

That works great! I have the user data.

Can you help we understand why this does not update my $Ticket_Data

I would use the for() to go through my data but someone pointed out in php this is slow. I was using the $i++ because $Ticket['user_id'] updates nothing. To get my changes to work I have had to use $Ticket_Data[$i]['user_id'].


$Ticket_Data = \App\SupportTickets::with('user')->get()->toArray();
    foreach ($Ticket_Data as $Ticket){
        $Ticket['user_id'] = $Ticket['user']['email'];
        $Ticket['title'] =  '<a href="/public/Admin/Tickets/Reply/'.$Ticket['id'].'">'.$Ticket['title'].'</a>';
        $Ticket['created_at'] = \Carbon\Carbon::parse($Ticket['created_at'])->diffForHumans();
        $Ticket['updated_at'] = \Carbon\Carbon::parse($Ticket['updated_at'])->diffForHumans();
        if($Ticket['status'] == "Pending")
            $Ticket['status'] = '<span style="color: #4b73f5;">Pending</span>';
        if($Ticket['status'] == "Open")
            $Ticket['status'] = '<span style="color: #db524b;">Open</span>';
    }
    dd($Ticket_Data);

SiNi_Si started a new conversation Get User From User_id From Array Not Collection

In my controller I'm fetching all my Support tickets and sending them to a javascript table. how do i get user data for my user like email and name from their user_id from my tickets table?

This must be done in the controller and not the blade.


$Ticket_Data = \App\SupportTickets::all()->toArray();
    $i = 0;
    foreach ($Ticket_Data as $Junk){
        $Ticket_Data[$i]['user_id'] = ?? Get user name from ticket user_id  ??
        $Ticket_Data[$i]['title'] =  '<a href="/public/Admin/Tickets/Reply/'.$Ticket_Data[$i]['id'].'">'.$Ticket_Data[$i]['title'].'</a>';
        $Ticket_Data[$i]['created_at'] = \Carbon\Carbon::parse($Ticket_Data[$i]['created_at'])->diffForHumans();
        $Ticket_Data[$i]['updated_at'] = \Carbon\Carbon::parse($Ticket_Data[$i]['updated_at'])->diffForHumans();
        if($Ticket_Data[$i]['status'] == "Pending")
            $Ticket_Data[$i]['status'] = '<span style="color: #4b73f5;">Pending</span>';
        if($Ticket_Data[$i]['status'] == "Open")
            $Ticket_Data[$i]['status'] = '<span style="color: #db524b;">Open</span>';
        $i++;
    }

In my User Model


public function SupportTickets() {
        $this->hasMany('App\SupportTickets');
    }

In my Ticket Model


public function user() {
        return $this->belongsTo('App\User','id','user_id');
    }

P.S. don't ask about the foreach() if I use $Junk['title'] = $Junk['title']."somthing"; nothing ever updates in the $Ticket_Data array.

Thanks

21 Oct
9 months ago

SiNi_Si left a reply on Search Arrays For $value In Key Name

I did cheat and got this to work. But it would be cool if anyone did know how to do this in the future.

SiNi_Si started a new conversation Search Arrays For $value In Key Name

I'm on may last set of migrating db user from the new site from the old. Trying to move everything to eloquent to my admin dashboard to do this weekly with a button. As I work on the new site.

This has been a pain pulling just the data that I need from 2 tables into one clean small table. The old site had just name and no first or last name or username. NOT GOOD . I have been breaking up names or emails to get a first, last, and username. ALL GOOD

My Last problem was the Username needs to be unique. So add I add the usernames if one his there I just add _XX on the end.

Now for the question. In my loop of packaging up data how to I search the 'name' key for to use something like in_array?

My old code was just searching through a simple array.


$AddIt = 0;
$last_name[] = "Fred";

if (in_array($temp_name, $user_name)) { $user_name[] = $temp_name."_".$AddIt; $AddIt++; }

But now with keys in my loop this will not work


if (in_array($temp_name, $Old_Users[?]['name'])) 

968 => array:13 [▼
    "id" => 968
    "email" => "[email protected]"
    "password" => "******"
    "market" => 1
    "city" => 1
    "country" => 1
    "address" => 1
    "company" => 1
    "zip" => 1
    "name" => "Name_0"
    "first_name" => "super"
    "last_name" => "user"
    "email_verified_at" => "2016-10-04 16:42:37"
  ]
  1284 => array:13 [▼
    "id" => 1284
    "email" => "[email protected]"
    "password" => "*****"
    "market" => 1
    "city" => 1
    "country" => 1
    "address" => 1
    "company" => 1
    "zip" => 1
    "name" => "Name_1"
    "first_name" => "admin"
    "last_name" => "none"
    "email_verified_at" => "2017-10-03 09:25:55"
  ]

Just a Sunday coding question

Thanks Si

20 Oct
9 months ago

SiNi_Si left a reply on Do I Still Need Mysqli_real_escape_string In Eloquent?

Thanks, good to know. I'm coming from C++ so all new to me.

Have a good weekend

SiNi_Si left a reply on Do I Still Need Mysqli_real_escape_string In Eloquent?

Cool, thanks that did it!


$New_Reply = new \App\SupportReply;
for ($i = 0; $i < (count($Old_Replies)); $i++){
     $Old_Replies[$i]['message'] = str_replace(' ', '-', $Old_Replies[$i]['message']); 
     $Old_Replies[$i]['message'] = preg_replace('/[^A-Za-z0-9\-]/', '', $Old_Replies[$i]['message']); 
     $New_Reply->insert($Old_Replies[$i]);
 }