/**
  * Store a newly created resource in storage.
  * POST /credit
  *
  * @return Response
  */
 public function store()
 {
     $input = Input::all();
     $v = Validator::make(Input::All(), array('type' => 'required', 'amount' => 'required'));
     if ($v->passes()) {
         Credit::create($input);
         return Redirect::intended('admin/credit');
     }
     return Redirect::back()->withInput()->withErrors($v)->with('message', 'There were validation errors');
 }
示例#2
0
 public static function createCredit($companyId, $type = self::FREE, $quantity = 10)
 {
     return Credit::create(["company_id" => $companyId, "type" => $type, "quantity" => $quantity]);
 }