| 1 | <?php namespace Arcanedev\LaravelSeo\Models;  | 
            ||
| 18 | class Redirect extends AbstractModel  | 
            ||
| 19 | { | 
            ||
| 20 | /* -----------------------------------------------------------------  | 
            ||
| 21 | | Properties  | 
            ||
| 22 | | -----------------------------------------------------------------  | 
            ||
| 23 | */  | 
            ||
| 24 | /**  | 
            ||
| 25 | * The attributes that are mass assignable.  | 
            ||
| 26 | *  | 
            ||
| 27 | * @var array  | 
            ||
| 28 | */  | 
            ||
| 29 | protected $fillable = ['old_url', 'new_url', 'status'];  | 
            ||
| 30 | |||
| 31 | /**  | 
            ||
| 32 | * The attributes that should be cast to native types.  | 
            ||
| 33 | *  | 
            ||
| 34 | * @var array  | 
            ||
| 35 | */  | 
            ||
| 36 | protected $casts = [  | 
            ||
| 37 | 'status' => 'integer',  | 
            ||
| 38 | ];  | 
            ||
| 39 | |||
| 40 | /* -----------------------------------------------------------------  | 
            ||
| 41 | | Constructor  | 
            ||
| 42 | | -----------------------------------------------------------------  | 
            ||
| 43 | */  | 
            ||
| 44 | /**  | 
            ||
| 45 | * Meta constructor.  | 
            ||
| 46 | *  | 
            ||
| 47 | * @param array $attributes  | 
            ||
| 48 | */  | 
            ||
| 49 | public function __construct(array $attributes = [])  | 
            ||
| 55 | |||
| 56 | /* -----------------------------------------------------------------  | 
            ||
| 57 | | Main Methods  | 
            ||
| 58 | | -----------------------------------------------------------------  | 
            ||
| 59 | */  | 
            ||
| 60 | /**  | 
            ||
| 61 | * Create a redirect url.  | 
            ||
| 62 | *  | 
            ||
| 63 | * @param string $oldUrl  | 
            ||
| 64 | * @param string $newUrl  | 
            ||
| 65 | * @param int $status  | 
            ||
| 66 | *  | 
            ||
| 67 | * @return \Arcanedev\LaravelSeo\Models\Redirect  | 
            ||
| 68 | */  | 
            ||
| 69 | public static function createOne($oldUrl, $newUrl, $status = Response::HTTP_MOVED_PERMANENTLY)  | 
            ||
| 81 | }  | 
            ||
| 82 |