Giter Site home page Giter Site logo

Comments (6)

devnick avatar devnick commented on June 14, 2024 1

@w1n78 not sure if you resolved this yet or not, but this should do the trick.

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use Tmdb\Helper\ImageHelper;
use Tmdb\Repository\MovieRepository;
use Tmdb\Repository\SearchRepository;
use Tmdb\Model\Search\SearchQuery\MovieSearchQuery;

class TmdbController extends Controller
{
    private $movies;
    private $helper;

    public function __construct(MovieRepository $movies, ImageHelper $helper, SearchRepository $search)
    {
        $this->movies = $movies;
        $this->helper = $helper;
        $this->search = $search;
    }

    public function search()
    {

        $data = [
            'page_title'            => 'Search TMDB',
            'navi_group'            => 'search',
            'navi_submenu'          => 'search',
            'results'               => $this->search->searchMovie('batman', new MovieSearchQuery)
        ];

        return view('tmdb.search', $data);
    }
}

from laravel.

devnick avatar devnick commented on June 14, 2024 1

@w1n78 No problem! You are correct in that the individual Movie objects contain all of the methods required to retrieve the data necessary for each item.

I agree with you in terms of the sparse documentation. An organized Wiki would certainly be nice, but fortunately the source code is documented quite well and the there are several typical examples there that help to put things in perspective.

Also, just an FYI, on this call:

$this->search->searchMovie('batman', new MovieSearchQuery)

you'll probably want to chain the toArray() method on it to get an actual returnable dataset back from the searchMovie() method. So:

$this->search->searchMovie('batman', new MovieSearchQuery)->toArray()

should get you the data you want.

from laravel.

MarkRedeman avatar MarkRedeman commented on June 14, 2024 1

In case you (or someone else reading this) hadn't seen the examples from the original php-tmdb/api repo, here is a link.

Please feel free to send any Pull Request on documentation, code or anything you like. Both me and @wtfzdotnet don't (actively?) use this project so it's hard to come up with useful documentation.

from laravel.

sherwinmartin avatar sherwinmartin commented on June 14, 2024

@devnick thank you so much. i knew i was missing something. i was so close haha. i also assume all the methods are found in \Tmdb\Model\Movie.php right? i wish there were more sample code. i have a hard time understanding some times

from laravel.

sherwinmartin avatar sherwinmartin commented on June 14, 2024

@devnick ok cool thanks. yes, i found the examples but i had to change it so i can use it in laravel. i was so close just couldn't get that second argument to work haha. once i get used to it, i'll probably contribute some example code i use in the wiki that uses laravel. thanks again. i'm rewriting an old codeigniter app i had done a few years ago using the tmdb api. i'm just rusty.

from laravel.

wtfzdotnet avatar wtfzdotnet commented on June 14, 2024

Hey Guys,

I used to use this project for an in-house application to show and list movies that used to be on a certain machine :-). I however since moved to alternatives and pretty much abandoned this application.

We could really use the help of the community to keep maintaining this library, I still maintain the base library on a "sort of common basis", but I'd really prefer the community taking over and just supervising the pull requests.

That said, any attributions to any of the projects in our organisation whether it's documentation or code additions or modifications, they are more than welcome! And I would really encourage you to do so, if you have any questions about the inner workings of php-tmdb/api and help documenting or creating examples that will make it easier for other people that come along after you, please don't hesitate to write me an e-mail :)

from laravel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.