niyo

niyo

Member Since 4 Months Ago

Experience Points
2,020
Total
Experience

2,980 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
2
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your 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-in-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 Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist 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.

Level 1
2,020 XP
Aug
01
2 weeks ago
Activity icon

Replied to Login With Twitter In Socialite

@tinfoilman thanks alot men it worked well i read in the docs of twitter and i found that i had access to have the email address in Permissions i made an edit on Additional permissions to accept emails to my app and i regenerated new Access token & access token secret to make my change of permissions work

Jul
28
2 weeks ago
Activity icon

Replied to Login With Twitter In Socialite

approved how there is a time that i waited like month to be enabled to create an app on twitter

so, which approval that i to wait for and why do they give me the username so not given the email

Activity icon

Replied to Login With Twitter In Socialite

@tinfoilman hey i get but i there any way i can use cause i need that email in my project there is a step that requires email so really need it

Jul
23
3 weeks ago
Activity icon

Started a new Conversation Login With Twitter In Socialite

my error: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'email' cannot be null (SQL: insert into users (name, email, updated_at, created_at) values (john dove, ?, 2020-07-23 08:35:11, 2020-07-23 08:35:11))

am not getting the email but i can get the name on my twitter name i don't know why this happen

public function redirectToTwitter ()
    {
        return Socialite::driver('twitter')->redirect();
    }

    public function handleTwitterCallback ()
    {
        $provider = Socialite::driver('twitter')->user();
        
        $user = User::where('provider_id', $provider->getId())->first();
        
        if(!$user)
        {
            $user = User::create([
                'name' => $provider->getName(),
                'email' => $provider->getEmail(),
                'provider_id' => $provider->getId(),
            ]);
        }

        auth::login($user, true);
        return redirect($this->redirectTo);
    }
Jul
12
1 month ago
Activity icon

Replied to Symlink() Has Been Disabled For Security Reasons

@jlrdw i was may be mistake to write

the problem now i have is am seeing them in public/uploads

this but am using both same thing you gave and @snapey too but the problem is steal the same and there is no problem with asset helper cause is the one am using same as ur example

Jul
09
1 month ago
Activity icon

Replied to Symlink() Has Been Disabled For Security Reasons

@jlrdw am keeping them in upload folder and i found that it wasn't also the problem of "username/laravelpro/ ....../etc." its also steal the same

am also steal using public/upload

Activity icon

Replied to Symlink() Has Been Disabled For Security Reasons

@jlrdw try to show me how i can use asset helper. i don't know how it works

Activity icon

Replied to Symlink() Has Been Disabled For Security Reasons

@jlrdw i used all the steps @snapey gave me

<img src="{{ asset('upload/' . $post->file }}" >

its the one am using

just i think cause am using this

<?php

/**
 * Laravel - A PHP Framework For Web Artisans
 *
 * @package  Laravel
 * @author   Taylor Otwell <[email protected]>
 */

define('LARAVEL_START', microtime(true));

/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| our application. We just need to utilize it! We'll simply require it
| into the script here so that we don't have to worry about manual
| loading any of our classes later on. It feels great to relax.
|
*/

require __DIR__.'/../laravelpro/vendor/autoload.php';
//require __DIR__.'/vendor/autoload.php';

/*
|--------------------------------------------------------------------------
| Turn On The Lights
|--------------------------------------------------------------------------
|
| We need to illuminate PHP development, so let us turn on the lights.
| This bootstraps the framework and gets it ready for use, then it
| will load up this application so that we can run it and send
| the responses back to the browser and delight our users.
|
*/

$app = require_once __DIR__.'/../laravelpro/bootstrap/app.php';
//$app = require_once __DIR__.'/bootstrap/app.php';

/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request
| through the kernel, and send the associated response back to
| the client's browser allowing them to enjoy the creative
| and wonderful application we have prepared for them.
|
*/

$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);

$response = $kernel->handle(
    $request = Illuminate\Http\Request::capture()
);

$response->send();

$kernel->terminate($request, $response);

may be cause all folders are not in public_htm

Activity icon

Replied to Symlink() Has Been Disabled For Security Reasons

@snapey the problem now i have is am seeing them in public/uploads as they are surposed to be but when try to view them they show as there is no image inside i don't know why

may be is bcz i use '/home/username/laravelpro/public/upload' to get them not in public_htm folder

Jul
08
1 month ago
Activity icon

Replied to Symlink() Has Been Disabled For Security Reasons

@snapey i wonded if i can use other way without struggling with storage and save different way

just save the file to public/images or similar

and try to show me according to my code below

public function store(Request $request)
    {
        $this->validate($request, [
            'name' => 'required|min:3',
            'time' => 'required|min:3',
            'description' => 'required|min:10',
            'file' => 'required|file|max:2048'
        ]);

        $upload = $request->file('file');
        $path = $upload->store('public/storage/posts');

        $post = Post::create([
            'name' => $request->name,
            'time' => $request->time,
            'description' => $request->description,
            'file_title' => $upload->getClientOriginalName(),
            'file' => $path,
            'user_id' => Auth::user()->id
        ]);

        return redirect()->route('givePrice', $post->id);
        }
Jul
04
1 month ago
Activity icon

Replied to Symlink() Has Been Disabled For Security Reasons

@jlrdw no its only the admin and there is no need for bob to view it again

and let me tell you a bit on my project : it is for freelancing so ex: bob give a request as boss hiring a job may be he want us to create a logo of his business so he give us a small description on how he want it and also he has a picture like a suggestion to be look like the one he gave us, so the image can help us to give the image of the logo he wanted to be done. thats the use of the image he gave us

Activity icon

Replied to Login Using Different Roles Or Different Tables?

@player4 according to @martinbean he did explain it well no need of creating different tables

notice also in ur login controller just use this to determine who is logged in

//public $redirectTo = '/home';
    protected function redirectTo () {
        if(Auth::user()->usertype == 'admin') 
        {
            return 'dashboard';
        } 
        elseif(Auth::user()->usertype == 'manager')
        {
            return 'manager-dashboard';
        }
        else
        {
            return 'home';
        }
    }

you can also create another middleware for example: manager, as i did on admin and also look out about user policies will help u well

Activity icon

Replied to Login Using Different Roles Or Different Tables?

i think you need this for example you have users table and you set types of users and give them roles like(admin, manager, worker, etc..) and create a middleware for the roles you want

this a middleware for admin

<?php

namespace App\Http\Middleware;

use Closure;
use Illuminate\Support\Facades\Auth;

class AdminMiddleware
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        if(Auth::user()->usertype == 'admin') {
            return $next($request);
        } else {
            return back();
        }
        
    }
}

to create a middleware

php artisan make:middleware AdminMiddleware

then in users table

<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('name');
            $table->string('usertype')->nullable();
            $table->string('email')->unique();
            $table->timestamp('email_verified_at')->nullable();
            $table->string('password');
            $table->rememberToken();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}

and then go to your phpmyadmin in users table

then set any usertype you want for example(admin) then your roles will be setted well as u want let me know if you have a problem

Activity icon

Replied to Symlink() Has Been Disabled For Security Reasons

@tallaljamshed hey i did what you said but am steal seeing the same error or may be it take some time

i removed symlink in disable_functions but no change

Jul
03
1 month ago
Activity icon

Replied to How To Get All The Products Related To The User's Shop Choice

try to show your code so we know what we can help you

Activity icon

Replied to Symlink() Has Been Disabled For Security Reasons

yeah then try to show me in that way i gave u

Activity icon

Replied to Symlink() Has Been Disabled For Security Reasons

@jlrdw look it looks like this when i create a post and how the image are uploaded in my project

public function store(Request $request)
    {
        $this->validate($request, [
            'name' => 'required|min:3',
            'time' => 'required|min:3',
            'description' => 'required|min:10',
            'file' => 'required|file|max:2048'
        ]);

        $upload = $request->file('file');
        $path = $upload->store('public/storage/posts');

        $post = Post::create([
            'name' => $request->name,
            'time' => $request->time,
            'description' => $request->description,
            'file_title' => $upload->getClientOriginalName(),
            'file' => $path,
            'user_id' => Auth::user()->id
        ]);

        return redirect()->route('givePrice', $post->id);
        }

try to give me an example in this way so i can fix it well

Jul
02
1 month ago
Activity icon

Replied to Symlink() Has Been Disabled For Security Reasons

@snapey would you please show me how am confused about what you told me earlier

Activity icon

Replied to Symlink() Has Been Disabled For Security Reasons

@jlrdw try to show me how cause am not getting what you saying well

and also every user in my project to post an image must be authenticated and they pass everything according to there user_id

show me this u are saying : and use authorization to access them. You could (and this is just one way) Store the image names like:

Activity icon

Replied to Easier Way? Data Inside Out

the output must look like that cause dd() function is sorting according to your types and how you arranged your outputs in $output variable, thank god its not even an error

Activity icon

Replied to Symlink() Has Been Disabled For Security Reasons

steal the same my friend symlink() has been disabled for security reasons

Jul
01
1 month ago
Activity icon

Replied to Symlink() Has Been Disabled For Security Reasons

this link doesn't open https://medium.com/@amycancode/protecting-user-uploads-in-laravel-611b62e6bb0e

i don't the why every link am given of this site doesn't work medium.com i can't access

Activity icon

Replied to Symlink() Has Been Disabled For Security Reasons

@jlrdw according to that link i think is for helping to displaying images on the site not the created ones by the user

i think on the link above i gave u doesn't have issue for symlink problem the one of my site i gave u

Activity icon

Replied to Symlink() Has Been Disabled For Security Reasons

the problem is to use symlink() that is disabled but on my localhost everything works with no problems

i faced the issue while i hosted my website

the ones that needs to be secured are user uploads that i only see in my admin panel not for other users just admin

Activity icon

Replied to Symlink() Has Been Disabled For Security Reasons

@jlrdw may be i give u the link you see the website visit guavahire.com

Activity icon

Replied to Symlink() Has Been Disabled For Security Reasons

@snapey i trying to escape the public_html folder cause it can't work there

by the way i save them where am not getting it well

Activity icon

Replied to Symlink() Has Been Disabled For Security Reasons

@bobbybouwmann i already paid my hosting plan so, i can't change to another hosting company i can't loose my $50 bucks for 4 yrs host

Activity icon

Replied to Laravel Domain Group Issue

are you trying to create sub domains, if yes, go in your hosting dashboard create a subdomain and go to redirects and add each redirects to its subdomain

Activity icon

Replied to Symlink() Has Been Disabled For Security Reasons

@jlrdw where i have the issue i when a user upload an image only so i can't view it in my admin panel

but on my website images have no problem, the problem is the images kept in storage folder

Activity icon

Started a new Conversation Symlink() Has Been Disabled For Security Reasons

am on a using shared hosting and i can't access my files or uploaded pictures so i used symlink to create my storage folder for my files but its not creating the storage folder and i know also that they can't let me use symlink in public_html so i tried many ways its not working

<?php 

symlink('/home/username/laravelpro/storage/app/public', '/home/username/laravelpro/public/storage');

Jun
27
1 month ago
Activity icon

Replied to Use Gmail For Verification In Laravel

i changed APP_URL and it worked but why does it remove the style of my web it shows html style only with no designs i tried also look if its the problem of my folders but its not the problem why does it change

by the way when i view it without the email link am given i looks well as always but if i click the reset link am given it comes with no styles

Activity icon

Replied to Use Gmail For Verification In Laravel

am told to paste the url below so which will i move and paste my url

@isset($actionText)
@slot('subcopy')
@lang(
    "If you’re having trouble clicking the \":actionText\" button, copy and paste the URL below\n". is it here
    'into your web browser: [:actionURL](:actionURL)',
    [
        'actionText' => $actionText,
        'actionURL' => $actionUrl,
    ]
)
@endslot
@endisset
@endcomponent

may be in these variables below

Activity icon

Replied to Use Gmail For Verification In Laravel

@snapey by set google email account its done but the problem i have now is how can i edit the page that is sent to gmail may be reset password page or verification page then i put on my own designs

i want also to edit password reset link am given cause my users can't know that they should change from the url

http://localhost:/password/reset/ce1486d6f899b766d8d04622a42671cd41cba7dc6b9174cb47b4a55eb5a48626?email=vainqueurniyo%40gmail.com 

to this

http://localhost:8000/password/reset/ce1486d6f899b766d8d04622a42671cd41cba7dc6b9174cb47b4a55eb5a48626?email=vainqueurniyo%40gmail.com

another question what is the difference betwen

@csrf

and

 <input type="hidden" name="token" value="{{ $token }}">

reset password page

<form method="POST" action="{{ route('password.update') }}">
                @csrf

                <input type="hidden" name="token" value="{{ $token }}">

                <div class="row">
                  <div class="col-md-12">
                    <div class="form-group">
                      <label class="bmd-label-floating">{{ __('E-Mail Address') }}</label>
                      <input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ $email ?? old('email') }}" required autocomplete="email">
                      @error('email')
                          <span class="invalid-feedback" role="alert">
                              <strong>{{ $message }}</strong>
                          </span>
                      @enderror
                    </div>
                  </div>
                </div>
                <div class="row">
                  <div class="col-md-12">
                    <div class="form-group">
                      <label class="bmd-label-floating">{{ __('Password') }}</label>
                      <input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="new-password">
                      @error('password')
                          <span class="invalid-feedback" role="alert">
                              <strong>{{ $message }}</strong>
                          </span>
                      @enderror
                    </div>
                  </div>
                </div>
                <div class="row">
                  <div class="col-md-12">
                    <div class="form-group">
                      <label class="bmd-label-floating">{{ __('Confirm Password') }}</label>
                      <input id="password-confirm" type="password" class="form-control" name="password_confirmation" required autocomplete="new-password">
                      @error('email')
                          <span class="invalid-feedback" role="alert">
                              <strong>{{ $message }}</strong>
                          </span>
                      @enderror
                    </div>
                  </div>
                </div>
                <button type="submit" class="btn btn-info pull-right">{{ __('Reset Password') }}</button>
                <div class="clearfix"></div>
              </form>
Jun
26
1 month ago
Activity icon

Started a new Conversation Use Gmail For Verification In Laravel

i have an error on my website am trying to use gmail for password reset and verification email

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
[email protected]
MAIL_PASSWORD=123456
MAIL_ENCRYPTION=ssl
MAIL_FROM_ADDRESS= [email protected]
MAIL_FROM_NAME= webname

i used all the requests but am getting error like this

Failed to authenticate on SMTP server with username "[email protected]" using 3 possible authenticators. Authenticator LOGIN returned Expected response code 235 but got code "535", with message "535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 https://support.google.com/mail/?p=BadCredentials o66sm7898816qka.60 - gsmtp ". Authenticator PLAIN returned Expected response code 235 but got code "535", with message "535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 https://support.google.com/mail/?p=BadCredentials o66sm7898816qka.60 - gsmtp ". Authenticator XOAUTH2 returned Expected response code 250 but got code "535", with message "535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 https://support.google.com/mail/?p=BadCredentials o66sm7898816qka.60 - gsmtp ".

how can fix it

Jun
23
1 month ago
Activity icon

Replied to Mailgun Gives 401 Unathorized Response

i used this method but its not working am using localhost, i have all the requirements but doesn't work

i changed my mailgun to gmail account but steal giving me that error

please help me am stuck

Jun
22
1 month ago
Activity icon

Awarded Best Reply on 404 Page Not Found In Laravel

the solution was to move up findorfail($id) function and change to find($id)

Activity icon

Replied to 404 Page Not Found In Laravel

the solution was to move up findorfail($id) function and change to find($id)

Jun
03
2 months ago
Activity icon

Replied to 404 Page Not Found In Laravel

@michaloravec all i ready there are getting me confused i don't which one to use the one i tried also does'nt change any thing Illuminate\Database\Eloquent\ModelNotFoundException

give me the solution

Activity icon

Replied to 404 Page Not Found In Laravel

yeah not yet reached that id my posts in database are like 10 posts

but if i don't have that id in my database i want to show my user the same page of Page Not found 404.blade.php

Activity icon

Replied to 404 Page Not Found In Laravel

hey i did that before but the problem am facing right now is not resources/views/errors/404.blade.php

the one am on right now is Not Found but page Not Found worked for this resources/views/errors/404.blade.php but the other is because id not found for example

post/discussion/4 this works well post/discussion/4488 does'nt work or show me Not found

Activity icon

Replied to 404 Page Not Found In Laravel

the problem was that i were calling the errors folder in my post folder but solutions is resources/views/post/errors/

but i have another one like this for example when i type post/discussion/4 or the id that i don't have in my database it shows another page of : Not found , this not found i don't where its located to make it the same like Page Not found

Jun
02
2 months ago
Activity icon

Started a new Conversation 404 Page Not Found In Laravel

my problem is i created this page in my project but its not working i used all the steps in Handler.php also created a forlder for errors name my file 404.blade.php but its showing me errors

View [errors.404] not found.

handler.php

<?php

namespace App\Exceptions;

use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;

class Handler extends ExceptionHandler
{
    /**
     * A list of the exception types that are not reported.
     *
     * @var array
     */
    protected $dontReport = [
        //
    ];

    /**
     * A list of the inputs that are never flashed for validation exceptions.
     *
     * @var array
     */
    protected $dontFlash = [
        'password',
        'password_confirmation',
    ];

    /**
     * Report or log an exception.
     *
     * @param  \Exception  $exception
     * @return void
     */
    public function report(Exception $exception)
    {
        parent::report($exception);
    }

    /**
     * Render an exception into an HTTP response.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Exception  $exception
     * @return \Illuminate\Http\Response
     */
    public function render($request, Exception $exception)
    {
        if ($this->isHttpException($exception)) {
            if ($exception->getStatusCode() == 404) {
                return response()->view('errors' . '404', [], 404);
            }
        }
        return parent::render($request, $exception);
    }
}

this is my view

@extends('layouts.app')

@section('title')
    Page not found 
@endsection

@section('content')

<div class="container">
    <div class="center" style="margin-top: 150px; margin-bottom: 30px; text-align: center">
        <h1>Page not found!</h1>
        <p>Sorry, but the page you were looking for could not be found.</p>
    </div>
</div>

@endsection

@section('scripts')

@endsection

i don't know what's left to be added on that's all i have

May
31
2 months ago
Activity icon

Replied to Preventrerouting Pages Without Permision

thanks men it worked am not opening the thing that i didn't creat so, it was only to change its position as i used it before

Activity icon

Replied to Preventrerouting Pages Without Permision

all looks the same have same things i use post on my testing project but wanted to show you well what am using please don't be confused

Activity icon

Replied to Preventrerouting Pages Without Permision

on my other model which i use the same thing

Route::resource('graphics', 'GraphicsController');
Route::get('/grthankyou/{id}', '[email protected]')->name('grthankyou');
Activity icon

Replied to Preventrerouting Pages Without Permision

so, what is the solution

Activity icon

Replied to Preventrerouting Pages Without Permision

App\Graphic {#437 ▼
  #fillable: array:8 [▼
    0 => "name"
    1 => "time"
    2 => "description"
    3 => "file"
    4 => "file_title"
    5 => "amount"
    6 => "amount_file"
    7 => "user_id"
  ]
  #connection: null
  #table: null
  #primaryKey: "id"
  #keyType: "int"
  +incrementing: true
  #with: []
  #withCount: []
  #perPage: 15
  +exists: false
  +wasRecentlyCreated: false
  #attributes: []
  #original: []
  #changes: []
  #casts: []
  #dates: []
  #dateFormat: null
  #appends: []
  #dispatchesEvents: []
  #observables: []
  #relations: []
  #touches: []
  +timestamps: true
  #hidden: []
  #visible: []
  #guarded: array:1 [▼
    0 => "*"
  ]
}
2
null

this is what i got

Activity icon

Replied to Preventrerouting Pages Without Permision

@kalemdzievski yeah dump like how give me an example

Activity icon

Replied to Laravel Stripe API

yeah you can use it but first you need to register an account on stripe.com and get your api keys either live or test

Activity icon

Replied to Preventrerouting Pages Without Permision

the problem is not that one, now am using the same thing but its not working

public function view(User $user, Post $post)
    {
        return $user->id === $post->user_id;
    }

it was me who did this mistake while posting it so, the problem its steal the same