39 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| namespace App\Models;
 | |
| 
 | |
| use Illuminate\Database\Eloquent\Model;
 | |
| 
 | |
| class Price extends Model
 | |
| {
 | |
| 
 | |
|     // Price can differ for Adults, Children, Seniors, etc.
 | |
|     // Price can default to a base price, but can be overridden by a specific showing.
 | |
|     // When creating a showing, there will be rows for each price type.
 | |
|     // If for example a childrens price is manually removed, the ticket will not be available for children. (Handy for special events)
 | |
| 
 | |
|     protected $table = 'prices';
 | |
|     protected $primaryKey = 'price_id';
 | |
|     protected $fillable = [
 | |
|         'price_type', // ENUM: (Adult, Child, Senior, loveseat(2 people))
 | |
|         'price_value', // Decimal
 | |
|         'showing_id', // which showing is this price for?
 | |
|         'user_id', // who added the price?
 | |
|     ];
 | |
| 
 | |
|     protected $hidden = [
 | |
|         'created_at',
 | |
|         'updated_at',
 | |
|     ];
 | |
| 
 | |
|     public function showing()
 | |
|     {
 | |
|         return $this->belongsTo(Showing::class, 'showing_id', 'showing_id');
 | |
|     }
 | |
| 
 | |
|     public function user()
 | |
|     {
 | |
|         return $this->belongsTo(User::class, 'user_id', 'user_id');
 | |
|     }
 | |
| 
 | |
| }
 |