Comments (6)
@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.
@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.
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.
@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.
@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.
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)
- [L5.2] Update composer.json HOT 9
- Deprecate L4 and require PHP 5.6 HOT 1
- Not compatible with current Laravel version (5.2) HOT 17
- How does Pagination work? HOT 4
- Examples/Documentation HOT 2
- Level is not defined in Logger.php HOT 8
- Remove language for specific requests? HOT 3
- Convert Collection (ResultCollection, GenricCollection) to Array HOT 4
- Not working with Laravel 5.5 HOT 2
- Service provider auto discovery support not working HOT 1
- session token using Dependency injection HOT 5
- TV Shows HOT 1
- Giving Different Release Date Compared to TMDB developers.themoviedb.org
- Not working with laravel 5.8 HOT 9
- The directory "/tmp/php-tmdb-api" is not writable. HOT 1
- Laravel 6 support?
- Laravel 7 Support? HOT 3
- Laravel 7.x support? HOT 1
- I found a working fork for Laravel 7/8 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel.