ctf0

ctf0

Member Since 3 Years Ago

Experience Points 4,110
Experience
Level
Lessons Completed 34
Lessons
Completed
Best Reply Awards 0
Best Answer
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

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

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

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

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

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

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

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

07 Dec
1 year ago

ctf0 left a reply on Check If A Model Uses Soft Deleting

based on @nate.a.johnson

in_array('Illuminate\Database\Eloquent\SoftDeletes', class_uses($model))
17 Oct
1 year ago

ctf0 left a reply on Using Socialite/social Login With Laravel Passport

@llioor sorry for the last response, just noticed it now.

in case of having 2 users with the same email, there is a solution but u r still going to have issues when showing the user data, how are u going to tackle that ?

if you are not going to use the user email anywhere in ur app except for logging him in,then the solution would be.

1- create 2 records with the same email, one with providor_id and without. 2- now when the email try to login you check , is it through the social auth or the normal login form.

depend on the form the user has used to login with, u will login the user by id Auth::loginUsingId($user_id, true);

10 Oct
1 year ago

ctf0 left a reply on @hasSection Usage Enquiry

https://laravel.io/forum/02-06-2014-check-if-yieldsomething-is-set

/**
 * Checks whether a section has been captured yet.
 *
 * @param  string  $section
 * @return bool
 */
function content_for($section)
{
    return array_key_exists($section, app('view')->getSections());
}

@if(content_for('navbar')) navbar syntax @elseif(content_for('navbar-sticky')) navbar-sticky syntax @endif

07 Mar
1 year ago

ctf0 started a new conversation How To Share @php Block Across Partials

lets say we have a var call routeName that we want to share across several views,

@php
    $routeName = Route::currentRouteName();
@endphp 

so maybe we make a partial vars.blade.php and include it in each view we want this var

@include('_partials.vars')

but unfortunately this doesnt work, and i keep getting Undefined variable: routeName.

i tried to use @set but nothing changed, so did anyone came across such scenario ?

04 Jan
1 year ago

ctf0 left a reply on Using Socialite/social Login With Laravel Passport

i have an idea of the flow but not sure yet

  1. go through the usual socialite auth flow (redirectToProvider / handleProviderCallback)

  2. in the handleProviderCallback thats where you usually check for the user info in your db and decide whether to **create a user** or **login the user** or **dismiss the call**

  3. after you've done the checking for the user info in your db and you found it, thats where you would normally use

auth()->login(Socialite::driver($provider)->user(), true);

to login the user, however we will instead use passport so

  1. now we make an internal request to the oauth/authorize route to use Implicit Grant Tokens to get an access token, cuz we dont have the user password which is needed for the Password Grant Tokens

  2. return the access token and any other info ur client app may need.

03 Jan
1 year ago

ctf0 started a new conversation How To Change Img Url Through Middleware

so lets say u have an img over s3, which when used with

Storage::disk('s3')->url($img->link)

you would get something like

https://s3-us-west-2.amazonaws.com/bucket_name/123.jpg

and now i started using cloudfront and cuz the CNAME thing is not working and gives errors, so i was thinking of making a middleware that auto change that url to something else like

https://xxxx.cloudfront.net/123.jpg

so is that possible ?

31 Dec
1 year ago

ctf0 left a reply on How To Use Vue With Laravel Partials

for anyone who wants to have something like the above, the solution is quite simple, you can either

1- use the inline-template on the component tag

// layout.app
<component is="{{ $viewComp or '' }}" inline-template>
      @yield('content')
</component>

// login
@extends('layouts.app', ['viewComp'=>'login'])
@section('content')
     <!-- the login form -->
@endsection

2- use the component name with inline-template inside the partial file itself

so for the above example we would use

// layout.app
@yield('content')

// login
@extends('layouts.app')
@section('content')
    <login inline-template>
       <!-- your usual code in here -->
    </login>
@endsection

ctf0 started a new conversation How To Use Vue With Laravel Partials

in laravel you have a login & register partial which extends the layout.app file.

so how can we use vuejs to both forms submission, atm i tried https://laracasts.com/series/learning-vue-step-by-step/episodes/20 but it doesnt work with things like v-model / etc... and instead i get

demo.jpg

so have anyone gone through such scenario ?

ctf0 left a reply on Laravel 5.4 And Axios

ah yes, i forgot the correct header name, thanx for the headsup

ctf0 left a reply on Laravel 5.4 And Axios

try

axios.defaults.headers.common['csrfToken'] = document.querySelector('meta[name="csrf-token"]').getAttribute('content')
30 Dec
1 year ago

ctf0 started a new conversation How To Run Both Node.js And Laravel On The Same Server Using Laravel Forge

the main idea is to have SPA app "using vue / vue router" that use "Laravel" to fetch and save data.

from what i understood so far that i will need to have two servers running

1- nodejs to serve the UI 2- php to serve the data

and as in https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-14-04 it talks about having 2 servers which what most will do anyway, but i wanted to test the idea first of how things will communicate on forge using only one server b4 going through splitting into 2

28 Dec
1 year ago

ctf0 left a reply on API Authentication (with Passport)

@joshgallagher24 am new into this but please bear with me,

what if instead of using the local storage or even the cookie, we store both the (client_id / client_secret) in a file call cert.jsonand the (refresh_token / etc..) in another file call auth.json.

this way those info are always saved and temper free

ctf0 left a reply on API Authentication (with Passport)

after reading all the above,

isnt it possible for the client (SPA / mobile app) to save the creds (client_id / client_secret / ect..) into a cert or json file (something like google cert file) or maybe even like (how socialite package work when saving those info into the config file) and then include this file info on each request to the server ?

this way it wont be saved into local storage & it would tackle the cookie issue the was raised in @joshgallagher24 PR

22 Dec
1 year ago

ctf0 started a new conversation How To Combin Webpack With Scripts At The Same Time

currently i have

elixir(mix => {
  mix
        .webpack('app.js', 'public/assets/js/app-min.js')
        .webpack('extra.js', 'public/assets/js/extra-min.js')
    }
);

but what i want is to have only one file instead of 2 , so i tried

elixir(mix => {
  mix
        .webpack('app.js')
        .webpack('extra.js')
        .scripts(['app.js', 'extra.js'], 'public/assets/js/app-min.js');
    }
);

but now i get 3 files :(.

19 Dec
1 year ago

ctf0 left a reply on Laracasts Refresh

@JeffreyWay dont you think the series episode would look better if it was like

demo.png

05 Oct
2 years ago

ctf0 left a reply on Method Lists Does Not Exist

yeah i just found it, but the funny thing its mentiond under https://laravel.com/docs/5.3/upgrade#upgrade-5.2.0 which it not correct as it was working until i upgraded to v5.3

04 Oct
2 years ago

ctf0 left a reply on About Homestead

homestead is simply a sandbox env , so instead of installing all the packages locally (php,redis,mysql,etc...) u just install them on the vm and delete/update/replace as u want without effecting ur main machine.

02 Oct
2 years ago

ctf0 started a new conversation Split Routes Into Categories On Laravel V5.3

on v5.2 i was having

foreach (File::allFiles(__DIR__ . '/Routes') as $route_file) {
  require_once $route_file->getPathname();
}

in routes.php, but now with v5.3 am getting Method lists does not exist. so does anyone knows a way to mimic the above in the new version ?

27 Sep
2 years ago

ctf0 left a reply on Setting On Node.js Socket.io On Laravel Forge

i run sudo node the-script.js and the cert issue is gone, if the forge daemon is not working with this as a root or ubuntu user, u can try using pm2 instead https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-14-04 , however i've done the above and am still getting Failed to load resource: net::ERR_CONNECTION_TIMED_OUT .................... https://mysite.com:8000/socket.io/?EIO=3&transport=polling&t=LTipSFb Failed to load resource: net::ERR_CONNECTION_TIMED_OUT

10 Sep
2 years ago

ctf0 left a reply on Laravel Elixir Does Not Remove CSS Comments With --production Flag

here is with the latest

elixir.config.css.minifier.pluginOptions = {
    keepSpecialComments: 0
};
07 Sep
2 years ago

ctf0 left a reply on Processing AJAX Requests From Vue.js

@vitorarjol maybe this should be Vue.http.headers.common['X-CSRF-TOKEN'] = document.querySelector('#_token').getAttribute('value');

21 Aug
2 years ago

ctf0 left a reply on Overwhelmed But Moving Forward ...

kinda late to the party but from ur project specs maybe this could help

1- get to know some of bootstrap stuff "its basicly some html and css to get u quickly going" , no worries as u will learn the rest as u progress & u can start with understanding the grid system. 2- there is more than one series for php basics "i would recommend at least going through one series b4 starting with laravel" it will help u alot when u start working with laravel , specially the namespace and use statement which is kinda a pain with the releases after v4.2 . 3- u can certainly ignore using js and relay mostly on the backend action and redirection , but some simple jquery understanding wont hurt and same as bootstrap u will start to pick up the pace as u go a long.

4- as u mentioned that u need to use like a central hub where things gets updated and notifications get displayed, for that u will need websocket or ajax but WS is much better in many ways.

  • the good news that the new upcoming release of laravel v5.3 will have a better support/workflow for websocket with the help of vue.js
  • also by the time u finish BS and Laravel ,v2 of vue would be offecialy released which should make things much easier to learn

5- some of vue.js stuff could be annoying "components for example" , u can ignore it and just go with the other features, and the good thing with vue is that the syntax is very similar to laravel that u will feel right at home using it.

ctf0 left a reply on Asking About Jeffrey Way Laracon Video

maybe he would give a one in the EU conf like the last year.

13 Jul
2 years ago

ctf0 left a reply on Laravel Socialite Facebook - Bad Request

as @deanhowe said , go to ur config/service

'facebook' => [
        'client_id'     => xxx', // Settings/Basic > APP ID
        'client_secret' => 'xxx',   // Settings/Basic > App Secret
        'redirect'      => 'http://localhost:8000/auth/facebook/callback', // FacebookLogin/ Client OAuth Settings
    ],
16 Feb
2 years ago

ctf0 left a reply on [L5] Validating Multiple File Input

@canfiax that didnt work, its as in the docs, simply image.* will validate each item in the array but the error will always come back as required

11 Feb
2 years ago

ctf0 left a reply on [L5] Validating Multiple File Input

@canfiax really !!! why in the gods name they don't include this in the docs ?!! , anyway i will test it today and get back to u, thanx for ur help :)

02 Feb
2 years ago

ctf0 left a reply on [L5] Validating Multiple File Input

i know its kinda old post but doesn't the new 5.2 have a native .* to validate multiple inputs ? https://laravel.com/docs/5.2/validation#validating-arrays or is it different from the above approach ?