Comments (5)
Hello, @imsidz.
You haven't provided full debug, but I suppose that addLikeTo
method receiving null
or Article
instance without implemented \Cog\Likeable\Contracts\Likeable
interface.
Could you provide more information? Does your Article
model implements Likeable
interface?
Here is how Likeable model should be prepared.
from laravel-likeable.
i am trying to add likeable to movies model
here is model
<?php
namespace App;
use Ghanem\Rating\Traits\Ratingable as Rating;
use Nicolaslopezj\Searchable\SearchableTrait;
use Illuminate\Database\Eloquent\Model;
use Cog\Likeable\Contracts\Likeable as LikeableContract;
use Cog\Likeable\Traits\Likeable;
class Movie extends Model
{
use Likeable;
use SearchableTrait;
use Rating;
here is controller
public function movielike($movie){
$movie = Movie::where('slug', $movie)->firstorfail();
$movie->like();
/**
$user = Auth::user();
$reward = 5;
$currentreward = $user->reward;
$user->reward = $currentreward + $reward;
$user->save();
**/
return Redirect::back()->with('status', 'like Success');
}
i think i am using same like documentation
from laravel-likeable.
@imsidz you've forgot to implement contract for Movie
model.
<?php
namespace App;
use Ghanem\Rating\Traits\Ratingable as Rating;
use Nicolaslopezj\Searchable\SearchableTrait;
use Illuminate\Database\Eloquent\Model;
use Cog\Likeable\Contracts\Likeable as LikeableContract;
use Cog\Likeable\Traits\Likeable;
class Movie extends Model implements LikeableContract
{
use Likeable;
use SearchableTrait;
use Rating;
Just add implements LikeableContract
after extends Model
and it should work.
from laravel-likeable.
Ohh Lol I Really Sorry For that its working fine after implements
thank you for making this dependency its more help full
hope you can rating system or reward system
thanks anyway
from laravel-likeable.
Glad it's working!
We have rating system and awards packages but they are not open source yet. Maybe in near future 😉
from laravel-likeable.
Related Issues (11)
- Can I sort all my posts by the count of likes ? HOT 16
- Add Likes Statistics Service HOT 3
- List of users who liked the article HOT 6
- Liker not defined exception HOT 4
- Sorting by likes doesn't sort by the different between likes and dislikes HOT 3
- Too few arguments to function Laravel 5.5 HOT 6
- Unable to get liked from a collection HOT 11
- weird issue when deleting a mongodb model HOT 8
- Deleting a likeable model causes a SQL error HOT 2
- Package is ABANDONED. Switch to Laravel Love!
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-likeable.