henryoladj

henryoladj

Member Since 11 Months Ago

Experience Points
5,810
Total
Experience

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
0
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 2
5,810 XP
Mar
14
5 months ago
Activity icon

Replied to Image Upload On Vultr Nginx (504 Gateway Time-out)

Could someone tell me what to do

Activity icon

Started a new Conversation Image Upload On Vultr Nginx (504 Gateway Time-out)

In my controller i have this code

private function storeImage($post)
    {
        if (request()->hasFile('image')){

            $original = request()->file('image')->getClientOriginalName();

            $post->update([
                'image' => request()->file('image')->storeAs('uploads', $original),
            ]);

            $image = Image::make('image/'. $post->image);
            $image->save();
        }
    }

which stores image on localhost but does not store image on my Vultr Ubuntu 19.10 x64 it loads after a while when i click create then gives this error 504 Gateway Time-out

the above code creates an image folder and also uploads folder on localhost but is not working on Vultr

Activity icon

Started a new Conversation SQLSTATE[HY000] [2054] The Server Requested Authentication Method Unknown

SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client (SQL: select max(`batch`) as aggregate f  
  rom `migrations`) 
SQLSTATE[HY000] [2054] The server requested authentication method unknown to the clien
Activity icon

Replied to 502 Bad Gateway On Vultr (Nginx)

now i am getting this error SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client (SQL: select count(*) as aggregate from `posts`)

Activity icon

Replied to 502 Bad Gateway On Vultr (Nginx)

@sinnbeck how can i grant privileges to root user on LEMP?

Activity icon

Replied to 502 Bad Gateway On Vultr (Nginx)

SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost' (SQL: select count(*) as aggregate from `posts`)

Activity icon

Replied to 502 Bad Gateway On Vultr (Nginx)

Anytime i want to migrate i get this error

SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = blog and table_name  
   = migrations and table_type = 'BASE TABLE')     
SQLSTATE[HY000] [2002] Connection refused 
Activity icon

Replied to 502 Bad Gateway On Vultr (Nginx)

Now when i go to my website i get Server Error

500 | Server Error

Activity icon

Started a new Conversation 502 Bad Gateway On Vultr (Nginx)

I have installed laravel on my Ubuntu Ubuntu 19.10 x64 with nginx/1.16.1 (Ubuntu) i have 1GB Ram and 25SSD

But anytime i go to my IP address i get 502 Bad Gateway.

What am i doing wrong?

Mar
13
5 months ago
Activity icon

Replied to Image Source Not Readable (what Am I Doing Wrong)

@notimeforcaution @sinnbeck I have created the aws account and linked it on my laravel, the images are storing inside aws and also in my database.

but i do not want to use aws url but my own website url to access the image like so ````localhost:8000/images/uploads/image.jpg```

private function storeImage($post)
    {
        if (request()->hasFile('image')){

            $original = request()->file('image')->getClientOriginalName();

            $post->update([
                'image' => request()->file('image')->storeAs('uploads', $original),
            ]);

            $image = Image::make(request()->file('image'));
            Storage::disk('s3')->put('uploads', $image->stream(), 'public');
            $image = Storage::disk('s3')->temporaryUrl("uploads", Carbon::now()->addMinutes(5));
            $image = 'http://localhost:8000/images/';
        }
    }

I want this image link to change from the one below

@if($post->image)
        <img class="post-image rectangle" src="{{ secure_asset('https://example-bucket.s3.eu-west-2.amazonaws.com/' . $post->image ) }}">
        @endif

to something like this

@if($post->image)
    <img class="post-image rectangle" src="{{ secure_asset('images/' . $post->image ) }}">
@endif

which displays an image link like this http://localhost:8000/images/uploads/image.jpg

mind you image is stored in my database like uploads/image.jpg

Activity icon

Replied to Laravel Custom Command Not Working

@sinnbeck I got this error

Symfony\Component\Debug\Exception\FatalThrowableError  : Class 'App\Console\Commands\User' not found

  at C:\MAMP\htdocs\blog-laravel\app\Console\Commands\CreateUserAdmin.php:48
    44|             'email' => '[email protected]',
    45|             'password' => bcrypt('secret')
    46|
    47|         ];
  > 48|         User::create($user); //creates the user
    49|         $this->info('User created!'); //feedback to the user that is successful
    50|     }
    51| }
    52|

  Exception trace:

  1   App\Console\Commands\CreateUserAdmin::handle()
      C:\MAMP\htdocs\blog-laravel\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:32

  2   call_user_func_array([])
      C:\MAMP\htdocs\blog-laravel\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:32

  Please use the argument -v to see more details.
Activity icon

Started a new Conversation Laravel Custom Command Not Working

I am trying run a command to create new user in my database but anytime i run it it does not create in the database CreateAdminUser.php

<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;

class CreateUserAdmin extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'create:user';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Create User';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $user = [
            'name' => 'Henry Oladeji',
            'username' => 'holadeji',
            'usertype' => 'admin',
            'email' => '[email protected]',
            'password' => bcrypt('secret')
            
        ];
    }
}

User.php

protected $fillable = [
        'name', 'username', 'usertype', 'email',  'password',
    ];

Kernel.php

protected $commands = [
        Commands\CreateUserAdmin::class,
    ];

What am i doing wrong?

Activity icon

Replied to Call To A Member Function Posts() On Null

this is my route

Route::get('{category?}', '[email protected]')->name('news.index');

i have category music with url localhost:8000/music

but url like this localhost:8000/sksmksk goes to category page instead of 404

Activity icon

Replied to Call To A Member Function Posts() On Null

@tykus it worked but when i enter a wrong page or url it does not go to 404. instead it loads the category page.

Mar
12
5 months ago
Activity icon

Replied to Image Source Not Readable (what Am I Doing Wrong)

@sinnbeck i am just getting this "path/to/image.jpg" after dd($image)

Activity icon

Replied to Image Source Not Readable (what Am I Doing Wrong)

@notimeforcaution i have made it public but it is giving me Not Found if i try to access it with http://localhost:8000/images/uploads/01-Motigbana.jpg

But it is working with the aws s3 link

Activity icon

Replied to Image Source Not Readable (what Am I Doing Wrong)

@notimeforcaution @sinnbeck so no way it can load from my own url instead of s3 url?

Activity icon

Replied to Image Source Not Readable (what Am I Doing Wrong)

@notimeforcaution anytime i visit the image url e.g localhost:8000/images/uploads/image.jpg it usually says NOT FOUND the image saves in the database and also at S3

Controller

private function storeImage($post)
    {
        if (request()->hasFile('image')){

            $original = request()->file('image')->getClientOriginalName();

            $post->update([
                'image' => request()->file('image')->storeAs('uploads', $original),
            ]);

            $image = Image::make(request()->file('image'));
            Storage::disk('s3')->put('uploads', $image->stream());
            $image = Storage::disk('s3')->temporaryUrl("uploads", Carbon::now()->addMinutes(5));
        }
    }
Activity icon

Replied to Image Source Not Readable (what Am I Doing Wrong)

@notimeforcaution it is saving now and it is updated in my database but it is not displaying on the website so i added this

$image = Image::make(request()->file('image'));
            Storage::disk('s3')->put("uploads", $image->stream());
            return Storage::disk('s3')->temporaryUrl("uploads", Carbon::now()->addMinutes(5));

It is giving this error Class 'Carbon' not found

also how can i display it on the blade

<img class="post-image rectangle" src="{{ secure_asset('image/' . $post->image ) }}">

it is storing as uploads\image.jpg in the database

Activity icon

Started a new Conversation Image Source Not Readable (what Am I Doing Wrong)

I am trying to store my images on Aws and show it on my blog page.

immediately i post with images it shows this Image source not readable but the image is saved on aws.

Controller

private function storeImage($post)
    {
        if (request()->hasFile('image')){

            $original = request()->file('image')->getClientOriginalName();

            $post->update([
                'image' => request()->file('image')->storeAs('uploads', $original),
            ]);

            $image = Image::make(public_path('image/'. $post->image));
            $image->save();
        }

Filesystem.php

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Default Filesystem Disk
    |--------------------------------------------------------------------------
    |
    | Here you may specify the default filesystem disk that should be used
    | by the framework. The "local" disk, as well as a variety of cloud
    | based disks are available to your application. Just store away!
    |
    */

    'default' => env('FILESYSTEM_DRIVER', 's3'),

    /*
    |--------------------------------------------------------------------------
    | Default Cloud Filesystem Disk
    |--------------------------------------------------------------------------
    |
    | Many applications store files both locally and in the cloud. For this
    | reason, you may specify a default "cloud" driver here. This driver
    | will be bound as the Cloud disk implementation in the container.
    |
    */

    'cloud' => env('FILESYSTEM_CLOUD', 's3'),

    /*
    |--------------------------------------------------------------------------
    | Filesystem Disks
    |--------------------------------------------------------------------------
    |
    | Here you may configure as many filesystem "disks" as you wish, and you
    | may even configure multiple disks of the same driver. Defaults have
    | been setup for each driver as an example of the required options.
    |
    | Supported Drivers: "local", "ftp", "sftp", "s3"
    |
    */

    'disks' => [

        'local' => [
            'driver' => 's3',
            'root' => public_path('image/'),
        ],

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

        's3' => [
            'driver' => 's3',
            'key' => env('AWS_ACCESS_KEY_ID'),
            'secret' => env('AWS_SECRET_ACCESS_KEY'),
            'region' => env('AWS_DEFAULT_REGION'),
            'bucket' => env('AWS_BUCKET'),
            'url' => env('AWS_URL'),
        ],

    ],

];

Blade

<img class="post-image rectangle" src="{{ secure_asset('image/' . $post->image ) }}">

What am i doing wrong?

Activity icon

Replied to Storing Images On Amazon S3 Instead Of Local Disk

It saving at my aws bucket but it still gives Image source not readable

Activity icon

Replied to Storing Images On Amazon S3 Instead Of Local Disk

@martinbean i am getting this Image source not readable

Activity icon

Replied to Storing Images On Amazon S3 Instead Of Local Disk

@martinbean i have set the access key and secret.

Activity icon

Replied to Please Help Me To Deploy My Laravel Project

@ozen777 if it is shared hosting make sure you change the website path to load from public, like example.com/public

Ask bluehost to change this for you on Cpanel, tell them to make your domain load from example.com/public but make sure you have the laravel folder(extracted) on your host.

Activity icon

Started a new Conversation Storing Images On Amazon S3 Instead Of Local Disk

On my Controller i have this but the images saves on the local disk, i want to know how i can save it on my Amazon S3

private function storeImage($post)
    {
        if (request()->hasFile('image')){

            $original = request()->file('image')->getClientOriginalName();

            $post->update([
                'image' => request()->file('image')->storeAs('uploads', $original),
            ]);

            $image = Image::make(public_path('image/'. $post->image));
            $image->save();
        }
    }

What should be edited filesystems.php

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Default Filesystem Disk
    |--------------------------------------------------------------------------
    |
    | Here you may specify the default filesystem disk that should be used
    | by the framework. The "local" disk, as well as a variety of cloud
    | based disks are available to your application. Just store away!
    |
    */

    'default' => env('FILESYSTEM_DRIVER', 'local'),

    /*
    |--------------------------------------------------------------------------
    | Default Cloud Filesystem Disk
    |--------------------------------------------------------------------------
    |
    | Many applications store files both locally and in the cloud. For this
    | reason, you may specify a default "cloud" driver here. This driver
    | will be bound as the Cloud disk implementation in the container.
    |
    */

    'cloud' => env('FILESYSTEM_CLOUD', 's3'),

    /*
    |--------------------------------------------------------------------------
    | Filesystem Disks
    |--------------------------------------------------------------------------
    |
    | Here you may configure as many filesystem "disks" as you wish, and you
    | may even configure multiple disks of the same driver. Defaults have
    | been setup for each driver as an example of the required options.
    |
    | Supported Drivers: "local", "ftp", "sftp", "s3"
    |
    */

    'disks' => [

        'local' => [
            'driver' => 'local',
            'root' => public_path('image/'),
        ],

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

        's3' => [
            'driver' => 's3',
            'key' => env('AWS_ACCESS_KEY_ID'),
            'secret' => env('AWS_SECRET_ACCESS_KEY'),
            'region' => env('AWS_DEFAULT_REGION'),
            'bucket' => env('AWS_BUCKET'),
            'url' => env('AWS_URL'),
        ],

    ],

];
Activity icon

Replied to Call To A Member Function Posts() On Null

@tykus after doing that i got this on my view Invalid argument supplied for foreach()

@foreach($posts as $post)
<a href="{{ route('posts.show',$post->slug) }}" class="card single">
	<span class="post-meta-information">
		{{ $post->categories()->first()->name }}
	</span>
	@if($post->image)
		<img class="post-image rectangle" src="{{ asset('image/' . $post->image ) }}">
	@endif
	<h3 class="title">{{$post->subject}}</h3>
	<p class="excerpt">{{ strip_tags($post->excerpt) }}</p>
	<div class="post-meta"></div>
</a>
@endforeach
Mar
11
5 months ago
Activity icon

Replied to Call To A Member Function Posts() On Null

@ajithlal i do not understand well

Activity icon

Started a new Conversation Call To A Member Function Posts() On Null

Anytime i log into my admin i get this error Call to a member function posts() on null

 (1/1) Error

Call to a member function posts() on null
in PostController.php line 40

Controller

public function index(Request $request, $category=null)
    {
        if($category){
            $categories = Category::with('posts')->get();
            $musics = Music::with('posts')->limit(5)->get();
            $musicsides = Music::with('posts')->limit(3)->get();
            $videos = Video::with('posts')->limit(5)->get();
            $videosides = Video::with('posts')->limit(3)->get();
            $trends = Trend::with('posts')->limit(5)->get();
            $reviews = Review::with('posts')->limit(6)->get();
            $category=Category::where('url',$category)->first();
            $posts=$category->posts()->latest()->paginate(15);
            $ts='MonstaJams';
        }else{
            $posts= Post::latest()->paginate(15); 
        }
        return view('categories.posts',compact(['posts','category', 'categories', 'musics', 'trends','videos', 'reviews', 'musicsides', 'videosides','ts']));
    }
Activity icon

Replied to Laravel 404 Not Found On Heroku

@stereoh i created a folder called nginx_app.conf in my laravel root directory inside it i have

server {
    listen 80;
    server_name https://shielded-ravine-33858.herokuapp.com/;
    root /https://shielded-ravine-33858.herokuapp.com//public;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";

    index index.html index.htm index.php;

    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    error_page 404 /index.php;

    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        include fastcgi_params;
    }

    location ~ /\.(?!well-known).* {
        deny all;
    }
}

in my Procfile i have web: vendor/bin/heroku-php-nginx public/

But it is still giving 404 and i have those pages and route set up well.

What am i doing wrong

Activity icon

Replied to Laravel 404 Not Found On Heroku

@siangboon it works when i use apache2 but gives 404 with nginx

Activity icon

Started a new Conversation Laravel 404 Not Found On Heroku

I currently deployed my laravel app on heroku server but when i go to some pages like the log in page, it gives me 404 not found.

I am guessing it has to do with the routes the web.php file

Procfile web: vendor/bin/heroku-php-nginx public/ What am i doing wrong.

Thanks

Mar
10
5 months ago
Activity icon

Replied to The GET Method Is Not Supported For This Route. Supported Methods: POST

i am using shared hosting, how will i use php artisan with it?

Activity icon

Started a new Conversation The GET Method Is Not Supported For This Route. Supported Methods: POST

i currently pushed my laravel project to namecheap shared hosting and i am having this problem when trying to post The GET method is not supported for this route. Supported methods: POST

But it is working well when i use my localhost Mamp

Mar
08
5 months ago
Activity icon

Replied to Related Post (Trying To Get Property 'url' Of Non-object )

@sinnbeck is this correct then?

@foreach($related as $related)
		
<div class="story">
<a href="#"><img src="{{ asset('image/' . $post->image ) }}" alt="">
</a>
<p class="title"><a href="#">{{$post->subject}}</a></p>
</div>
			
@endforeach
Activity icon

Replied to Related Post (Trying To Get Property 'url' Of Non-object )

@sinnbeck i have this

Illuminate\Support\Collection {#2610 ▼
  #items: array:1 [▼
    0 => 3
  ]
}
4
Activity icon

Replied to Related Post (Trying To Get Property 'url' Of Non-object )

@sinnbeck It shows the id which is 4 & 3

3
4
Activity icon

Replied to Related Post (Trying To Get Property 'url' Of Non-object )

@sinnbeck it shows

App\Post {#2606 ▼
  #table: "posts"
  #fillable: array:7 [▶]
  #connection: "mysql"
  #primaryKey: "id"
  #keyType: "int"
  +incrementing: true
  #with: []
  #withCount: []
  #perPage: 15
  +exists: true
  +wasRecentlyCreated: false
  #attributes: array:12 [▶]
  #original: array:12 [▶]
  #changes: []
  #casts: []
  #dates: []
  #dateFormat: null
  #appends: []
  #dispatchesEvents: []
  #observables: []
  #relations: []
  #touches: []
  +timestamps: true
  #hidden: []
  #visible: []
  #guarded: array:1 [▶]
}
App\Post {#1505 ▼
  #table: "posts"
  #fillable: array:7 [▶]
  #connection: "mysql"
  #primaryKey: "id"
  #keyType: "int"
  +incrementing: true
  #with: []
  #withCount: []
  #perPage: 15
  +exists: true
  +wasRecentlyCreated: false
  #attributes: array:12 [▶]
  #original: array:12 [▶]
  #changes: []
  #casts: []
  #dates: []
  #dateFormat: null
  #appends: []
  #dispatchesEvents: []
  #observables: []
  #relations: array:1 [▶]
  #touches: []
  +timestamps: true
  #hidden: []
  #visible: []
  #guarded: array:1 [▶]
}
Activity icon

Replied to Related Post (Trying To Get Property 'url' Of Non-object )

@sinnbeck it is just showing the exact post of that page as the related post instead of some few posts related to it.

Mar
06
5 months ago
Activity icon

Replied to Related Post (Trying To Get Property 'url' Of Non-object )

@sinnbeck i want to use id instead of url

$related = Post::whereHas('categories', function($query) use ($post) {
    $query->whereIn('url', $post->categories->pluck('url'));
})->where('id', '<>', $post->id)->limit(5)->get();

Because the id shows the relationship between posts and categories

But this gives this

$related = Post::whereHas('categories', function($query) use ($post) {
    $query->whereIn('id', $post->categories->pluck('id'));
})->where('id', '<>', $post->id)->limit(5)->get();

gives this error SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'id' in where clause is ambiguous (SQL: select * from `posts` where exists (select * from `categories` inner join `categories_posts` on `categories`.`id` = `categories_posts`.`category_id` where `posts`.`id` = `categories_posts`.`post_id` and `id` in (1)) and `id` <> 3 limit 5)

Activity icon

Replied to Related Post (Trying To Get Property 'url' Of Non-object )

@sinnbeck

syntax error, unexpected ';', expecting ',' or ')' 
Activity icon

Replied to Related Post (Trying To Get Property 'url' Of Non-object )

@sinnbeck i am getting this error

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'category_id' in 'where clause' (SQL: select * from `posts` where `category_id` in (1) limit 6) 
Activity icon

Replied to Related Post (Trying To Get Property 'url' Of Non-object )

Controller

$related= Post::whereIn('category_id', $post->categories->pluck('id'));

I tried displaying it on my view like this

@foreach($related->take(6) as $relate)
<img src="{{ asset('image/' . $post->image ) }}" alt="">
@endforeach

But it is not showing and i have two posts of same ID category.

Activity icon

Replied to Related Post (Trying To Get Property 'url' Of Non-object )

@sinnbeck

Post Model

public function categories()
    {
        return $this->belongsToMany(Category::class, 'categories_posts');
    }

Category Model

public function posts()
    {
    	return $this->belongsToMany(Post::class, 'categories_posts');
    }
Activity icon

Replied to Related Post (Trying To Get Property 'url' Of Non-object )

Yes it gives Null

In my database i have

Posts Table

  • ID

Categories Table

  • ID

and i have relationship categories_posts table which has ID of Post and ID of Category.

So how do i go with it?