psychosocial227

psychosocial227

Member Since 9 Months Ago

Experience Points 810
Experience Level 1

4,190 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 1
Lessons
Completed
Best Reply Awards 0
Best Reply
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.

18 Apr
4 days ago

psychosocial227 started a new conversation Best Practice To Handle Integrity Violation Error For Unique Field

More closely laravel related. Hi all i have a slug field that set to unique it inherit the title input and use the php substr function to shorten the slug and str_replace to add hyphen to space to make the uri appear apealing and readable to users. I run into an integrity violation error whick okay but how i handle the problem isn't satisfied by me as i was unable to wrap my brain on how to handle the situation as directed by the laravel documentation. This how i get it fixed .

 $slug_errorbag = Post::all();  // Get item from database
       foreach ($slug_errorbag as $slug_errorbag) {  //iterate the item
           if ($post->slug  ===  $slug_errorbag->slug ) { // Compare if it match any slug item
//If true tell the user to suffix his or her title
           }
       } 
// continue and save to DB

If this database should grow in future i see it as a problem. I might be wrong will love to hear your thought......

15 Apr
1 week ago

psychosocial227 left a reply on Laravel

@JLRDW - I finally sort it out. Telling me what i ought to know before jumping into laravel is of no impotant if you want to assist. Thanks

psychosocial227 left a reply on Laravel

@SNAPEY - Can you give me a sample on how to handle multiple select.

psychosocial227 left a reply on Laravel

@SNAPEY - get to see your old answer related to this same issue and i was able to wrap my brain around it . Thanks yhis how the final code look <select class="custom-select form-control" name="category_id" required> @foreach($category as $categories) <option value="{{ $categories->id }}" {{old('category_id', $post->category_id) == $categories->id ? 'selected' : ''}} >{{$categories->name }} <span class="badge badge-success" data-placement="left" title="No. of post"> {{$categories->posts->count()}} </span> </option> @endforeach </select>

psychosocial227 left a reply on Laravel

@TYKUS - Like can i use the $model->category_id without requiring laravel-collective or form helper

psychosocial227 left a reply on Laravel

@SNAPEY - Please i will need a sample on how to pass the previous choice to the view. Thanks

psychosocial227 left a reply on Laravel

@SNAPEY - Can i use model binding with native or bootsratp form. If yes i will be needing a sample on how to implement it.

psychosocial227 left a reply on Laravel

@TYKUS - Can i use model binding with native or bootsratp form. If yes i will be needing a sample on how to implement it.

psychosocial227 started a new conversation Javascript

Hi all. I have a select field in my form for users to select tags and category I would like the state of the previous selected tags/category to be highlighted why editing the form. Can this be done just using the natural laravel flow or implementing some few lines of vanilla js(Ajax). Thanks .Answers should be strongly laravel related.

06 Dec
4 months ago

psychosocial227 started a new conversation Target A Single Post Using Laravel Notification

Hi artisans am using laravel notification to notify my subscribe users of new post posted on a blog but i run into an issue as i cannot target the particular post that is posted or approved by admin if the user click the action button. From the code below if a user click it redirect them to another page on the site. This pastebin https://paste.laravel.io/898a2be5-716e-45bc-9fd6-961f85a6c66c

This my to mail method

public function toMail($notifiable)
    {
        return (new MailMessage)
            ->subject('New Post Available')
            ->greeting('Hello, Subscriber')
            ->line('There is a new post. We hope you will like it.')
            ->line('Post Title : '.$this->post->title)
            ->action('View Post', url('post/{{$post->slug}}'))
            ->line('Thank you for using our application!');
    }

Thanks for your guidance.

05 Dec
4 months ago

psychosocial227 left a reply on Laravel Image Broken After App Was Running Okay

@LOSTDREAMER_NL - I don't know honestly and i don't know how an app that was working fine just stop.

psychosocial227 left a reply on Laravel Image Broken After App Was Running Okay

@LOSTDREAMER_NL - *The image is in the storage folder *Yes the image attribute is set *Image URl can be access *Even old image that work properly are affected

psychosocial227 started a new conversation Laravel Image Broken After App Was Running Okay

Hi my app was running preety well until today i realise image link is broken why working with notification and hoping to deploy anytime soon and a nighmare emerge. Here is how i set up my image algorithm. Am using intervention image package. As i said everything was working perfectly fine as first and i will be grateful if anyone can help with this nightmare.

This my store method

*public function store(Request $request) { $this->validate($request,[ 'title' => 'required', 'image' => 'required', 'categories' => 'required', 'body' => 'required', ]); $image = $request->file('image'); $slug = str_slug($request->title); if(isset($image)) { # make unipue name for image $currentDate = Carbon::now()->toDateString(); $imageName = $slug.'-'.$currentDate.'-'.uniqid().'.'.$image->getClientOriginalExtension(); if(!Storage::disk('public')->exists('post')) { Storage::disk('public')->makeDirectory('post'); } $postImage = Image::make($image)->resize(1600,1066)->stream(); Storage::disk('public')->put('post/'.$imageName,$postImage); } else { $imageName = "purple.png"; } $post = new Post(); $post->user_id = Auth::id(); $post->title = $request->title; $post->slug = $slug; $post->image = $imageName; $post->body = $request->body; $post->save();

    return redirect()->route('admin.post.index');
}*

This my view and this how the image is called

{{ asset('Storage/post/'.$post->image) }}

php artisan storage:link have been utilized

this how my filesystem is set up

'default' => env('FILESYSTEM_DRIVER', 'local'), 'disks' => [ 'local' => [ 'driver' => 'local', 'root' => storage_path('app'), ], 'public' => [ 'driver' => 'local', 'root' => storage_path('app/public'), 'url' => env('APP_URL').'/storage', 'visibility' => 'public', ],

If am missing anything please let me know thanks in advance.

28 Nov
4 months ago

psychosocial227 left a reply on Content Seclusion From Some Link

@LOSTDREAMER_NL - Thanks man the issue was from my root.

psychosocial227 left a reply on Content Seclusion From Some Link

@LOSTDREAMER_NL - Route::get('/portfolio', '[email protected]')->name('portfolio'); and this {{-- @if( request()->routeIs('portfolio.index') ) @csrf

                    <button class="btn gradient_dark btn-sm" type="submit"> Search  </button>
                </form> </span> 

@else This one does not @endif --}} but this one does not pop out on all route not only the portolio route

psychosocial227 left a reply on Content Seclusion From Some Link

@LOSTDREAMER_NL - Still the opposite i wish i can solve my problem is eating me up and my method exhibit same character and it was cause of the issue i ask for help.

psychosocial227 left a reply on Content Seclusion From Some Link

@REALRANDYALLEN - Was thinking content here will be return if on a paticular route and content return when in other root.

psychosocial227 left a reply on Content Seclusion From Some Link

@LOSTDREAMER_NL - It work the opposite instead and return this one does not on my porfolio route.

psychosocial227 started a new conversation Content Seclusion From Some Link

Hi all i will be needing an assistance. I have a navbar that all link on my app use but i will like to seclude a search form from some of the link in the app but am having difficulty doing that. This what i have tried on my nabvar so far example

Tried using route but no success @if( (route('portfolio') &&(route('portfolio.details) content here @else content @endif

then i tried targeting the URI

@if( Request::is('/portfolio') &&(route('portfolio/details) content here @else content @endif NOne seems to working. PHP and Laravel

05 Nov
5 months ago

psychosocial227 left a reply on Conditional Logic

I will like to avoid such repetition.

psychosocial227 started a new conversation Conditional Logic

This destroy method work perfectly well using laravel framework to delete a single file.

  • public function destroy(portfolio $portfolio) { if(Storage::disk('public')->exists('portfolio/'.$portfolio->cover) { Storage::disk('public')->delete('portfolio/'.$portfolio->cover); } $portfolio->delete(); Session::flash('status', 'Portfolio deleted succesfully'); return redirect()->back(); } }

But i have 4 file that i will like to delete how do one pass such logic and this what i have tried.

*public function destroy(portfolio $portfolio)
    {

        if(Storage::disk('public')->exists('portfolio/'.$portfolio->cover && Storage::disk('public')->exists('portfolio/'.$portfolio->detail_1) &&
        (Storage::disk('public')->exists('portfolio/'.$portfolio->detail_2 && Storage::disk('public')->exists('portfolio/'.$portfolio->detail_3) ) {
        
            Storage::disk('public')->delete('portfolio/'.$portfolio->cover);
            Storage::disk('public')->delete('portfolio/'.$portfolio->detail_1);
            Storage::disk('public')->delete('portfolio/'.$portfolio->detail_2);
            Storage::disk('public')->delete('portfolio/'.$portfolio->detail_3);
        }
        $portfolio->delete();
        Session::flash('status', 'Portfolio deleted succesfully');
        return redirect()->back();
    }
}*

psychosocial227 left a reply on Image Link Broken

@ munazzil you right b

Profile Image

psychosocial227 left a reply on Image Link Broken

munnazzi yes like this

Profile Image

01 Nov
5 months ago

psychosocial227 left a reply on Image Link Broken

Thanks pal but i solve it by adding the storage before profile.

psychosocial227 left a reply on Image Link Broken

Image still broken can you look at my config/filesystem setting to see if am making any mistake in my configuration.

psychosocial227 started a new conversation Image Link Broken

I will need your help as my image url appear to be broken in my browser which am sure i did everything correctly or so i think. I want to add an image to my update profile user acc below is how my code circle is structure. This my user table schema

 *public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');

            $table->integer('role_id')->default(2);
            $table->string('name');
            $table->string('username')->unique();
            $table->string('email')->unique();
            $table->string('password');
            $table->string('image')->default('default.png');
            $table->text('about')->nullable();
            $table->rememberToken();
            
            $table->timestamps();
        });
    }*

, this my setting controller that have the updateProfile method

*public function updateProfile(Request $request)
    {
        $this->validate($request,[
            'name' => 'required',
            'email' => 'required|email',
            'image' => 'required|image',
        ]);
        $image = $request->file('image');
        $slug = str_slug($request->name);
        $user = User::findOrFail(Auth::id());
        if (isset($image))
        {
            $currentDate = Carbon::now()->toDateString();
            $imageName = $slug.'-'.$currentDate.'-'.uniqid().'.'.$image->getClientOriginalExtension();
            if (!Storage::disk('public')->exists('profile'))
            {
             Storage::disk('public')->makeDirectory('profile');
            }
//            Delete old image form profile folder
            if (Storage::disk('public')->exists('profile/'.$user->image))
            {
                Storage::disk('public')->delete('profile/'.$user->image);
            }
            $profile = Image::make($image)->resize(500,500)->stream();
            Storage::disk('public')->put('profile/'.$imageName,$profile);
        } else {
            $imageName = $user->image;
        }
        $user->name = $request->name;
        $user->email = $request->email;
        $user->image = $imageName;
        $user->about = $request->about;
        $user->save();
        Toastr::success('Profile Successfully Updated :)','Success');
        return redirect()->back();*

, i have use the php artisan storage:link and here is my view linking to my public/profile directory

 *<a class="avatar" href="{{ route('author.profile',$post->user->username) }}"><img src="{{ Storage::disk('public')->url('profile/'.$post->user->image) }}" alt="Profile Image"></a>*

. Thanks in advance

14 Jul
9 months ago

psychosocial227 started a new conversation URLs For Controller Actions With Parameters With Form Submit

Post Title Slug Post Description Submit

Please someone should instruct me how to submit this form using URLs For Controller Actions. Thanks in advance.