monstajamss

monstajamss

Member Since 7 Months Ago

Experience Points
4,740
Total
Experience

260 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
10
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
4,740 XP
Sep
24
1 month ago
Activity icon

Started a new Conversation Laravel Upgrade From V7 To V8 Problem

I am trying to upgrade my laravel project from v7 to v8.

But i keep getting this error

  Problem 1
    - laravel-frontend-presets/now-ui-dashboard v1.0.3 requires laravel/framework ^7.0 -> satisfiable by laravel/framework[7.x-dev].
    - laravel-frontend-presets/now-ui-dashboard v1.0.3 requires laravel/framework ^7.0 -> satisfiable by laravel/framework[7.x-dev].
    - Can only install one of: laravel/framework[v8.6.0, 7.x-dev].
    - Installation request for laravel/framework 8.6 -> satisfiable by laravel/framework[v8.6.0].
    - Installation request for laravel-frontend-presets/now-ui-dashboard 1.0.3 -> satisfiable by laravel-frontend-presets/now-ui-dashboard[v1.0.3].

I have this in my composer.json

"require": {
        "php": "^7.3.0",
        "cviebrock/eloquent-sluggable": "8.0",
        "fideloper/proxy": "^4.2",
        "fruitcake/laravel-cors": "^2.0.2",
        "guzzlehttp/guzzle": "^7.1.0",
        "intervention/image": "^2.5",
        "laravel-frontend-presets/now-ui-dashboard": "1.0.3",
        "laravel/framework": "8.6",
        "laravel/legacy-factories": "^1.0",
        "laravel/tinker": "^2.4.2",
        "laravel/ui": "^3.0",
        "spatie/laravel-permission": "^3.17",
        "unicodeveloper/laravel-paystack": "dev-l8"
    },
    "require-dev": {
        "facade/ignition": "^2.3.6",
        "fzaninotto/faker": "^1.9.1",
        "mockery/mockery": "^1.3.1",
        "nunomaduro/collision": "^5.0",
        "phpunit/phpunit": "^9.0"
    },
Sep
19
1 month ago
Activity icon

Started a new Conversation Trying To Perform Migration "Illuminate\Database\QueryException"

I am getting this error

 SQLSTATE[42000]: Syntax error or access violation: 1103 Incorrect table name '' (SQL: create table `` (`id` bigint unsigned not null auto_increment primary key, `viewable_type` varchar(255) not null, `viewable_id` bigint unsigned not null, `visitor` text null, `collection` varchar(255) null, `viewed_at` timestamp default CURRENT_TIMESTAMP not null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')
estamp default CURRENT_TIMESTAMP not null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:671
    667▕         // If an exception occurs when attempting to run a query, we'll format the error
    668▕         // message to include the bindings with SQL, which will make this exception a
    669▕         // lot more helpful to the developer instead of just the database's errors.
    670▕         catch (Exception $e) {
  ➜ 671▕             throw new QueryException(
    672▕                 $query, $this->prepareBindings($bindings), $e
    673▕             );
    674▕         }
    675▕ 

      +8 vendor frames
  9   database/migrations/2020_09_19_212152_create_views_table.php:50
      Illuminate\Database\Schema\Builder::create()

      +22 vendor frames 
  32  artisan:37
      Illuminate\Foundation\Console\Kernel::handle()

This is what is in the migration file

<?php

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

class CreateViewsTable extends Migration
{
    /**
     * The database schema.
     *
     * @var \Illuminate\Support\Facades\Schema
     */
    protected $schema;

    /**
     * The table name.
     *
     * @var string
     */
    protected $table;

    /**
     * Create a new migration instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->schema = Schema::connection(
            config('eloquent-viewable.models.view.connection')
        );

        $this->table = config('eloquent-viewable.models.view.table_name');
    }

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        $this->schema->create($this->table, function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->morphs('viewable');
            $table->text('visitor')->nullable();
            $table->string('collection')->nullable();
            $table->timestamp('viewed_at')->useCurrent();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists($this->table);
    }
}

Sep
15
1 month ago
Activity icon

Started a new Conversation Laravel Page View Package

Does anyone know any laravel page view counter?

Normally i use cyrildewit/eloquent-viewable on version 7 but it does not work on v8.

Who knows any alternative?

Sep
11
1 month ago
Activity icon

Replied to Laravel V8 Admin Page Redirect

@jlrdw last question

i have usertype column in my user table which takes admin

How can i check if the user is admin in this controller and direct them to admin page?

public function index()
    {
        $role = Auth::user()->role;
        $checkrole = explode(',', $role);
        if (in_array('usertype', $checkrole)) {
            return redirect('admin/main');
        } else {
            return redirect('/');
        }
    }
Activity icon

Replied to Laravel V8 Admin Page Redirect

@jlrdw it has worked i had to put it at the top of the list in web.php

Thanks

Activity icon

Replied to Laravel V8 Admin Page Redirect

I have it still gives Not Found

Route::get('redirects', 'App\Http\Controllers\[email protected]dex');
Activity icon

Replied to Laravel V8 Admin Page Redirect

using your method gives me 404

web.php

Route::get('redirects', '[email protected]');

RouteServiceProvider.php

<?php

namespace App\Providers;

use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Facades\Route;

class RouteServiceProvider extends ServiceProvider
{
    /**
     * The path to the "home" route for your application.
     *
     * This is used by Laravel authentication to redirect users after login.
     *
     * @var string
     */
    public const HOME = 'redirects';


    protected $namespace = 'App\Http\Controllers';

    /**
     * Define your route model bindings, pattern filters, etc.
     *
     * @return void
     */
    public function boot()
    {
        $this->configureRateLimiting();

        $this->routes(function () {
            Route::middleware('web')
                ->namespace($this->namespace)
                ->group(base_path('routes/web.php'));

            Route::prefix('api')
                ->middleware('api')
                ->group(base_path('routes/api.php'));
        });
    }

JustController.php

 public function index()
    {
        $role = Auth::user()->role;
        $checkrole = explode(',', $role);
        if (in_array('admin', $checkrole)) {
            return redirect('admin/index');
        } else {
            return redirect('/');
        }
    }
Activity icon

Replied to Laravel V8 Admin Page Redirect

@jlrdw Laravel v8 still needs work... and i wish they can make things easier for us

Thanks for your solution

Activity icon

Started a new Conversation Laravel V8 Admin Page Redirect

Now that there is no logincontroller where the logic can be performed, how does one redirect admin user to its own dashboard??

assuming there is an admin column in the user table.

How will this work?

Sep
10
1 month ago
Activity icon

Replied to Log In With Username And Password In Laravel V8

So @jlrdw what is the solution to the username and email authentication?

Sep
08
1 month ago
Activity icon

Replied to Laravel 8: Jetstream; Livewire; Inertia Error

I prefer using livewire.

Activity icon

Replied to Laravel 8: Jetstream; Livewire; Inertia Error

Or you can do composer require inertiajs/inertia-laravel it should solve it.

Activity icon

Started a new Conversation APP_NAME Gives Error In .env

I am trying to change my APP_NAME =Laravel in .env to APP_NAME=Example Site but it gives error i guess due to the space between Example and Site.

How can i resolve this?

Activity icon

Replied to Log In With Username And Password In Laravel V8

@jlrdw what i meant was that i did not understand what you typed at first. But now i understand your point. Anytime they provide a solution please let me know.

Thanks.

Activity icon

Replied to Laravel 8: Jetstream; Livewire; Inertia Error

I had this same problem i had to create new project by using laravel new blog --jet

Activity icon

Replied to Log In With Username And Password In Laravel V8

@jlrdw i do not understand this please. I am confused

Activity icon

Started a new Conversation Log In With Username And Password In Laravel V8

I recently started using laravel v8 and i am trying to log in using username and email together but i do not know how to do this.

In laravel 7 i could use

protected function credentials(Request $request)
    {
        $field = filter_var($request->get($this->username()), FILTER_VALIDATE_EMAIL)
            ? $this->username()
            : 'username';
        return [
            $field => $request->get($this->username()),
            'password' => $request->password,
        ];
    }

How can i log in using both username and password in laravel v8 since there is no LoginController inside Auth folder anymore

Sep
06
1 month ago
Activity icon

Replied to Connection Could Not Be Established With Host Smtp.gmail.com :stream_socket_client(): Unable To Connect To Ssl://smtp.gmail.com:465 (Connection Timed Out)

@snapey I have this

"smtp" => [
         "transport" => "smtp",
         "host" => "smtp.gmail.com",
         "port" => "465",
         "encryption" => "ssl",
         "username" => "[email protected]",
         "password" => "password",
         "timeout" => null,
         "auth_mode" => null,
       ],
Activity icon

Replied to Connection Could Not Be Established With Host Smtp.gmail.com :stream_socket_client(): Unable To Connect To Ssl://smtp.gmail.com:465 (Connection Timed Out)

@snapey i did not change anything. That is the exact setting i have in my .env

I am currently hosting my website with linode.

Sep
05
1 month ago
Activity icon

Started a new Conversation Connection Could Not Be Established With Host Smtp.gmail.com :stream_socket_client(): Unable To Connect To Ssl://smtp.gmail.com:465 (Connection Timed Out)

I am trying to run user email verification in my laravel app.

But i keep getting this error

Connection could not be established with host smtp.gmail.com :stream_socket_client(): unable to connect to ssl://smtp.gmail.com:465 (Connection timed out)

I have this in my .env

MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
[email protected]
MAIL_PASSWORD=password
MAIL_ENCRYPTION=ssl
[email protected]
MAIL_FROM_NAME="${APP_NAME}"

What am i doing wrong

Activity icon

Started a new Conversation Laravel Email Verification Not Working On Linode Live Server

On my local server i have this in my web.php

Auth::routes(['verify' => true ]);

which sends notification to new users to confirm there email.

But on live server it does not work

i also have this in my web.php

Route::group(['middleware'=>'verified'], function(){
    Route::get('/create/{id}', '[email protected]')->name('post.create');
    Route::post('/post-store', '[email protected]');
    Route::get('/edit/{post:slug}', '[email protected]')->name('post.edit');
    Route::put('/post/{post:slug}', '[email protected]')->name('post.update');
});

which checks if the registered user has verified email address, this does not work on live server instead it allows unverified users to make post.

What am i doing wrong because i do not get any error.

Jul
27
2 months ago
Activity icon

Replied to Laravel Envoyer Problem

@michaloravec do you have any idea?

Jul
25
3 months ago
Activity icon

Replied to Laravel Envoyer Problem

Does anyone have any answer or response?

Jul
23
3 months ago
Activity icon

Started a new Conversation Laravel Envoyer Problem

I want to ask if it is possible to deploy laravel project using DigitalOcean and Laravel Envoyer instead of Laravel Forge and Laravel Envoyer.

If it is possible, how please??

Jul
19
3 months ago
Activity icon

Replied to Trying To Display Single Post Returns 404 Not Found

@michaloravec @michaloravec please i want the Page Title to be like this New Topic - Music, Sitename

so i did this

@section('title', $category->name .' - ')

and it is just giving me Music - Sitename

note: (Music) is the category name

Activity icon

Replied to Trying To Display Single Post Returns 404 Not Found

@mabdullahsari what about doing it like this

$post = Post::where('slug', '=', $slug)->firstorFail();
Activity icon

Started a new Conversation Trying To Display Single Post Returns 404 Not Found

I am trying to display single post details in my project

Route

Route::get('/post/{slug}', '[email protected]')->name('post.show');

Controller

public function show($slug)
    {
        $post = Post::findorFail($slug);
        return view('post.single', compact('post'));
    }

view link that leads to the single post gape

<h6 class="card-title"><a href="{{ route('post.show',$post->slug) }}"> {{ $post->subject }}</a>

When user click the link localhost:8000/post/example-post it gives Page Not Found

what am i doing wrong?

Activity icon

Replied to Redirect To Another Page After Making A Post

@marianomoreyra

This is my route

Route::get('/{category}', '[email protected]');
Jul
18
3 months ago
Activity icon

Replied to Redirect To Another Page After Making A Post

@jlrdw if i should do return redirect('/other/place'); it will not be dynamic

Activity icon

Started a new Conversation Redirect To Another Page After Making A Post

I have a category e.g music category.

How can i redirect or go to the category page when i am done making a post

i have this in my controller

 public function store(Request $request)
    {
        $validator = Validator::make($request->all(), [
            'subject' => 'required|min:20',
            'body' => 'required|min:20'
        ]);

        if ($validator->fails()) {
            return redirect()
                        ->back()
                        ->withErrors($validator)
                        ->withInput();
        }

        $post=auth()->user()->post()->create($request->all());

        $post->categories()->attach($request->categories);

        return redirect('/');
    }

The redirect('/) goes to the home page but i want to redirect it to the category page instead that i made the post under

My category link is like this localhost:8000/music

Activity icon

Replied to Trying To Get Property 'id' Of Non-object

@michaloravec please i want the Page Title to be like this New Topic - Music, Sitename

so i did this

@section('title', $category->name .' - ')

and it is just giving me Music - Sitename

note: (Music) is the category name

Activity icon

Replied to Trying To Get Property 'id' Of Non-object

@michaloravec it has worked

I am trying to get the Category Name for the Page title

what am i doing wrong

@section('title', {{$category->name}} . ' - ')

i got this syntax error, unexpected '<', expecting ')'

Activity icon

Replied to Trying To Get Property 'id' Of Non-object

@michaloravec but it is not still working still getting that error

Activity icon

Replied to Trying To Get Property 'id' Of Non-object

@michaloravec got this

array:5 [▼
  "id" => 1
  "name" => "Politics"
  "slug" => "politics"
  "created_at" => "2020-07-18T20:54:13.000000Z"
  "updated_at" => "2020-07-18T20:54:13.000000Z"
]
Activity icon

Replied to Trying To Get Property 'id' Of Non-object

@jlrdw i am not trying to loop

I am trying to do this <a href="/create/{{category->id}}">Create Topic</a>

Activity icon

Replied to Trying To Get Property 'id' Of Non-object

@michaloravec it does not work stil giving the error

Activity icon

Started a new Conversation Trying To Get Property 'id' Of Non-object

I am trying to get the id of a category

Controller

public function index(Request $request, $category=null)
    {  
        $category=Category::where('slug','=',$category)->first();
        $posts = Post::latest()->paginate(15);
        
        return view('category.news',compact('category','posts'));
    }

Route

Route::get('/{category}', '[email protected]');

View

{{$category->id}} 

gives me this error Trying to get property 'id' of non-object

Jul
11
3 months ago
Activity icon

Replied to Laravel Email Verification Process Throw Error

@sergiu17 which route would i change

Auth::routes(['verify' => true]);

Jul
10
3 months ago
Activity icon

Started a new Conversation Laravel Email Verification Process Throw Error

I am trying to make users verify email on my platform but anytime they login and they click the verification link like example.com/email/resend they get this error

ethodNotAllowedHttpException
HTTP 405 Method Not Allowed
The GET method is not supported for this route. Supported methods: POST.
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);$response = $kernel->handle(    $request = Illuminate\Http\Request::capture());$response->send();$kernel->terminate($request, $response);
MethodNotAllowedHttpException
in /app/vendor/laravel/framework/src/Illuminate/Routing/AbstractRouteCollection.php (line 117)
in /app/vendor/laravel/framework/src/Illuminate/Routing/AbstractRouteCollection.php -> methodNotAllowed (line 103)
in /app/vendor/laravel/framework/src/Illuminate/Routing/AbstractRouteCollection.php -> getRouteForMethods (line 40)
Jun
20
4 months ago
Activity icon

Replied to Implode(): Passing Glue String After Array Is Deprecated

Thanks everyone for answering, i really appreciate it. I was able to solve the problem by upgrading my Laravel project from Version 5 to Version 7. After doing that the website worked and i did not get that problem anymore.

Once again thanks @snapey @jeffreyway @michaloravec @preskhaled @jlrdw

Activity icon

Replied to Implode(): Passing Glue String After Array Is Deprecated

@snapey i do not know where i am getting the error from

Activity icon

Started a new Conversation Implode(): Passing Glue String After Array Is Deprecated

I am trying to make a post and i got this error ErrorException (E_DEPRECATED) implode(): Passing glue string after array is deprecated. Swap the parameters

C:\MAMP\htdocs\naijaswiftforum\vendor\cviebrock\eloquent-sluggable\src\Services\SlugService.php
     * @param mixed $from
     *
     * @return string
     */
    protected function getSlugSource($from): string
    {
        if (is_null($from)) {
            return $this->model->__toString();
        }
 
        $sourceStrings = array_map(function($key) {
            $value = data_get($this->model, $key);
            if (is_bool($value)) {
                $value = (int) $value;
            }
 
            return $value;
        }, (array) $from);
 
        return implode($sourceStrings, ' ');
    }
 
    /**
     * Generate a slug from the given source string.
     *
     * @param string $source
     * @param array $config
     * @param string $attribute
     *
     * @return string
     * @throws \UnexpectedValueException
     */
    protected function generateSlug(string $source, array $config, string $attribute): string
    {
        $separator = $config['separator'];

Can someone help?

Jun
14
4 months ago
Activity icon

Replied to Image Is Saving As /tmp In Laravel

I have solved it

  1. I did not add aws details to .env on nginx server
  2. i did not add another package details .env on nginx server
Activity icon

Replied to Image Is Saving As /tmp In Laravel

@jlrdw it says this

2020-06-14 21:00:32] production.ERROR: fopen(/var/www/laravel/public/image/uploads/1.png): failed to open stream: Permission denied {"userId":1,"exception":"[object] (ErrorException(code: 0): fopen(/var/www/laravel/public/image/uploads/1.png): failed to open stream: Permission denied at /var/www/laravel/vendor/league/flysystem/src/Adapter/Local.php:157)

Then

[2020-06-14 21:13:07] production.ERROR: URI must be a string or UriInterface (View: /var/www/laravel/resources/views/pages/welcome.blade.php) {"exception":"[object] (ErrorException(code: 0): URI must be a string or UriInterface (View: /var/www/laravel/resources/views/pages/welcome.blade.php) at /var/www/laravel/vendor/guzzlehttp/psr7/src/functions.php:62)